fix: 🗃️ settings table migration order

This commit is contained in:
IceToast 2023-02-19 01:03:24 +01:00 committed by IceToast
parent d6573b9bfd
commit f2a714cece
3 changed files with 12 additions and 24 deletions

View file

@ -1,22 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->rename('settings_old');
});
}
public function down()
{
Schema::table('settings_old', function (Blueprint $table) {
$table->rename("settings");
});
}
};

View file

@ -13,6 +13,12 @@ return new class extends Migration
*/
public function up()
{
// rename old settings table
Schema::table('settings', function (Blueprint $table) {
$table->rename('settings_old');
});
// create new settings table
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('name');
@ -31,5 +37,9 @@ return new class extends Migration
public function down()
{
Schema::dropIfExists('settings');
Schema::table('settings_old', function (Blueprint $table) {
$table->rename("settings");
});
}
};

View file

@ -24,10 +24,10 @@ return new class extends Migration
public function down()
{
Schema::create('settings_old', function (Blueprint $table) {
$table->string('key', 191);
$table->string('key', 191)->primary();
$table->text('value')->nullable();
$table->string('type');
$table->longText('description');
$table->longText('description')->nullable();
$table->timestamps();
});
}