store 5
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?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
|
||||
{
|
||||
if (! Schema::hasTable('categories')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('categories', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('categories', 'show_in_filter')) {
|
||||
$table->boolean('show_in_filter')->default(true)->after('active');
|
||||
}
|
||||
if (! Schema::hasColumn('categories', 'show_in_select')) {
|
||||
$table->boolean('show_in_select')->default(true)->after('show_in_filter');
|
||||
}
|
||||
if (! Schema::hasColumn('categories', 'sort_order')) {
|
||||
$table->unsignedSmallInteger('sort_order')->default(0)->after('show_in_select');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('categories')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('categories', function (Blueprint $table) {
|
||||
foreach (['sort_order', 'show_in_select', 'show_in_filter'] as $column) {
|
||||
if (Schema::hasColumn('categories', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user