added description
This commit is contained in:
@@ -21,6 +21,8 @@ return new class extends Migration
|
||||
$table->id();
|
||||
$table->string('module')->unique();
|
||||
$table->boolean('enabled')->default(true);
|
||||
$table->text('description')->nullable();
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('module_statuses')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('module_statuses', function (Blueprint $table): void {
|
||||
if (! Schema::hasColumn('module_statuses', 'description')) {
|
||||
$table->text('description')->nullable()->after('enabled');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('module_statuses', 'sort_order')) {
|
||||
$table->unsignedInteger('sort_order')->default(0)->after('description');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('module_statuses')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('module_statuses', function (Blueprint $table): void {
|
||||
if (Schema::hasColumn('module_statuses', 'sort_order')) {
|
||||
$table->dropColumn('sort_order');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('module_statuses', 'description')) {
|
||||
$table->dropColumn('description');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user