fix: 🗃️ settings table migration order
This commit is contained in:
parent
d6573b9bfd
commit
f2a714cece
|
@ -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");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -13,6 +13,12 @@ return new class extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
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) {
|
Schema::create('settings', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
@ -31,5 +37,9 @@ return new class extends Migration
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('settings');
|
Schema::dropIfExists('settings');
|
||||||
|
|
||||||
|
Schema::table('settings_old', function (Blueprint $table) {
|
||||||
|
$table->rename("settings");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,10 +24,10 @@ return new class extends Migration
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::create('settings_old', function (Blueprint $table) {
|
Schema::create('settings_old', function (Blueprint $table) {
|
||||||
$table->string('key', 191);
|
$table->string('key', 191)->primary();
|
||||||
$table->text('value')->nullable();
|
$table->text('value')->nullable();
|
||||||
$table->string('type');
|
$table->string('type');
|
||||||
$table->longText('description');
|
$table->longText('description')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue