merge migrations

This commit is contained in:
Alexis Gousseau 2024-04-26 10:25:03 +02:00
parent 2a9859bc90
commit e0dbae1c61
4 changed files with 15 additions and 65 deletions

View file

@ -1,8 +1,10 @@
<?php
use Database\Seeders\Mandatory\GeneralSettingSeeder;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Artisan;
return new class extends Migration
{
@ -14,10 +16,14 @@ return new class extends Migration
public function up(): void
{
Schema::create('general_settings', function (Blueprint $table) {
$table->unsignedTinyInteger('type')->unique()->comment('Enum SettingsType');
$table->json('value')->comment('The actual setting value');
$table->unsignedTinyInteger('type')->unique()->comment('General settings enum type (SettingsType).');
$table->json('value')->comment('General settings value (json).');
$table->timestamps();
});
Artisan::call('db:seed', [
'class' => GeneralSettingSeeder::class
]);
}
/**

View file

@ -1,8 +1,10 @@
<?php
use Database\Seeders\Mandatory\MenuNodeDataSeeder;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Artisan;
return new class extends Migration
{
@ -20,6 +22,7 @@ return new class extends Migration
$table->string('sub_label')->comment('(Left part) Link label');
$table->string('title')->comment('(Right part) Sub title');
$table->string('text')->comment('(Right part) Sub text');
$table->unsignedBigInteger('text_color')->comment('(Right part) Sub text color');
$table->string('link_url')->comment('(Right part) Link url');
$table->string('link_title')->comment('(Right part) Link title');
@ -37,6 +40,10 @@ return new class extends Migration
$table->timestamps();
});
Artisan::call('db:seed', [
'class' => MenuNodeDataSeeder::class
]);
}
/**

View file

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
// phpcs:disable Generic.Files.LineLength.TooLong
DB::statement("ALTER TABLE `general_settings` CHANGE `type` `type` TINYINT UNSIGNED NOT NULL COMMENT 'General settings enum type (SettingsType).'");
DB::statement("ALTER TABLE `general_settings` CHANGE `value` `value` LONGTEXT NOT NULL COMMENT 'General settings value (json).'");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
DB::statement("ALTER TABLE `general_settings` CHANGE `type` `type` TINYINT UNSIGNED NOT NULL COMMENT 'Enum SettingsType'");
DB::statement("ALTER TABLE `general_settings` CHANGE `value` `value` LONGTEXT NOT NULL COMMENT 'The actual setting value'");
// phpcs:enable Generic.Files.LineLength.TooLong
}
};

View file

@ -1,32 +0,0 @@
<?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(): void
{
Schema::table('menu_node_data', function (Blueprint $table) {
$table->unsignedBigInteger('text_color')->comment('(Right part) Sub text color')->after('text');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table('menu_node_data', function (Blueprint $table) {
$table->dropColumn('text_color');
});
}
};