Skip to content

Commit

Permalink
only add position column if it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
zeezo887 authored and ifox committed Dec 4, 2024
1 parent 2e0e217 commit f898b19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ public function up(): void
{
$twillMediablesTable = config('twill.mediables_table', 'twill_mediables');

Schema::table($twillMediablesTable, function (Blueprint $table) {
$table->integer('position')->default(1);
});
if (!Schema::hasColumn($twillMediablesTable, 'position')) {
Schema::table($twillMediablesTable, function (Blueprint $table) {
$table->integer('position')->default(1);
});
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ public function up(): void
{
$twillFileablesTable = config('twill.fileables_table', 'twill_fileables');

Schema::table($twillFileablesTable, function (Blueprint $table) {
$table->integer('position')->default(1);
});
if (!Schema::hasColumn($twillFileablesTable, 'position')) {
Schema::table($twillFileablesTable, function (Blueprint $table) {
$table->integer('position')->default(1);
});
}
}

/**
Expand Down

0 comments on commit f898b19

Please sign in to comment.