1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 07:57:46 +02:00

Migrations: Fix dropping foreign keys

Passing an array to dropForeign does not mean dropping multiple indices,
but rather dropping a key on multiple tables.

Passing a string means that this string will be interpreted as index
name, not as name of the indexed column. Passing an array with one
string is therefore correct, in order to benefit from automatic index
name generation.
This commit is contained in:
Franz Liedke
2018-11-30 14:04:44 +01:00
parent 147fc1a65e
commit 731da10088
2 changed files with 4 additions and 2 deletions

View File

@@ -37,7 +37,8 @@ return [
'down' => function (Builder $schema) {
$schema->table('posts_mentions_posts', function (Blueprint $table) use ($schema) {
$table->dropForeign(['post_id', 'mentions_post_id']);
$table->dropForeign(['post_id']);
$table->dropForeign(['mentions_post_id']);
Migration::fixIndexNames($schema, $table);
});

View File

@@ -37,7 +37,8 @@ return [
'down' => function (Builder $schema) {
$schema->table('post_mentions_user', function (Blueprint $table) use ($schema) {
$table->dropForeign(['post_id', 'mentions_user_id']);
$table->dropForeign(['post_id']);
$table->dropForeign(['mentions_user_id']);
Migration::fixIndexNames($schema, $table);
});