ctrlpanel/database/migrations/2023_02_01_155730_create_new_settings_table.php

46 lines
1 KiB
PHP
Raw Normal View History

2023-02-01 19:33:36 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// rename old settings table
Schema::table('settings', function (Blueprint $table) {
$table->rename('settings_old');
});
// create new settings table
2023-02-01 19:33:36 +00:00
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->json('payload')->nullable();
$table->string('group')->index();
$table->boolean('locked');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('settings');
Schema::table('settings_old', function (Blueprint $table) {
$table->rename("settings");
});
2023-02-01 19:33:36 +00:00
}
};