This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?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
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('module_statuses')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('module_statuses', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('module')->unique();
|
||||
$table->boolean('enabled')->default(true);
|
||||
$table->text('description')->nullable();
|
||||
$table->string('version')->nullable();
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('module_statuses');
|
||||
}
|
||||
};
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<?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', 'version')) {
|
||||
$table->string('version')->nullable()->after('description');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('module_statuses', 'sort_order')) {
|
||||
$table->unsignedInteger('sort_order')->default(0)->after('version');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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', 'version')) {
|
||||
$table->dropColumn('version');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('module_statuses', 'description')) {
|
||||
$table->dropColumn('description');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?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', 'version')) {
|
||||
$table->string('version')->nullable()->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', 'version')) {
|
||||
$table->dropColumn('version');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('module_statuses', function (Blueprint $table): void {
|
||||
if (! Schema::hasColumn('module_statuses', 'icon')) {
|
||||
$table->string('icon')->nullable()->after('version');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('module_statuses', 'category')) {
|
||||
$table->string('category')->nullable()->after('icon');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('module_statuses', 'vendor_type')) {
|
||||
$table->string('vendor_type')->nullable()->after('category');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('module_statuses', 'author')) {
|
||||
$table->string('author')->nullable()->after('vendor_type');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('module_statuses', 'notes')) {
|
||||
$table->text('notes')->nullable()->after('author');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('module_statuses', function (Blueprint $table): void {
|
||||
foreach (['notes', 'author', 'vendor_type', 'category', 'icon'] as $column) {
|
||||
if (Schema::hasColumn('module_statuses', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user