mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
fix: check if contributing_artist_id exists before dropping
This commit is contained in:
parent
7d76773454
commit
a594e3dfdb
1 changed files with 6 additions and 4 deletions
|
@ -12,10 +12,12 @@ return new class extends Migration
|
|||
// This migration is actually to fix a mistake that the original one was deleted.
|
||||
// Therefore, we just "try" it and ignore on error.
|
||||
try {
|
||||
Schema::disableForeignKeyConstraints();
|
||||
$table->dropForeign('songs_contributing_artist_id_foreign');
|
||||
$table->dropColumn('contributing_artist_id');
|
||||
Schema::enableForeignKeyConstraints();
|
||||
if (Schema::hasColumn('songs', 'contributing_artist_id')) {
|
||||
Schema::disableForeignKeyConstraints();
|
||||
$table->dropForeign('songs_contributing_artist_id_foreign');
|
||||
$table->dropColumn('contributing_artist_id');
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
} catch (Throwable) {
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue