fix: check if contributing_artist_id exists before dropping

This commit is contained in:
Phan An 2022-08-04 17:48:43 +02:00
parent 7d76773454
commit a594e3dfdb
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC

View file

@ -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 {
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) {
}
});