mirror of
https://github.com/flarum/core.git
synced 2025-07-28 12:10:51 +02:00
Fix index names in migrations
This can be reverted when we upgrade to Laravel 5.7.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
@@ -26,15 +27,19 @@ return [
|
||||
})
|
||||
->delete();
|
||||
|
||||
$schema->table('post_mentions_post', function (Blueprint $table) {
|
||||
$schema->table('post_mentions_post', function (Blueprint $table) use ($schema) {
|
||||
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
|
||||
$table->foreign('mentions_post_id')->references('id')->on('posts')->onDelete('cascade');
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('posts_mentions_posts', function (Blueprint $table) {
|
||||
$schema->table('posts_mentions_posts', function (Blueprint $table) use ($schema) {
|
||||
$table->dropForeign(['post_id', 'mentions_post_id']);
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
@@ -9,6 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
@@ -26,15 +27,19 @@ return [
|
||||
})
|
||||
->delete();
|
||||
|
||||
$schema->table('post_mentions_user', function (Blueprint $table) {
|
||||
$schema->table('post_mentions_user', function (Blueprint $table) use ($schema) {
|
||||
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
|
||||
$table->foreign('mentions_user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('post_mentions_user', function (Blueprint $table) {
|
||||
$schema->table('post_mentions_user', function (Blueprint $table) use ($schema) {
|
||||
$table->dropForeign(['post_id', 'mentions_user_id']);
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
Reference in New Issue
Block a user