Fix a potential migration bug

This commit is contained in:
Phan An 2017-12-01 17:50:28 +01:00
parent 3e3004a904
commit 6f9a057879

View file

@ -13,7 +13,9 @@ class RenameContributingArtistId extends Migration
public function up()
{
Schema::table('songs', function ($table) {
$table->dropForeign(['contributing_artist_id']);
$table->renameColumn('contributing_artist_id', 'artist_id');
$table->foreign('artist_id')->references('id')->on('artists')->onDelete('cascade');
});
}
@ -25,7 +27,9 @@ class RenameContributingArtistId extends Migration
public function down()
{
Schema::table('songs', function ($table) {
$table->dropForeign(['contributing_artist_id']);
$table->renameColumn('artist_id', 'contributing_artist_id');
$table->foreign('artist_id')->references('id')->on('artists')->onDelete('cascade');
});
}
}