mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 07:38:08 +08:00
Fix index names in migrations
This can be reverted when we upgrade to Laravel 5.7.
This commit is contained in:
parent
aa00a2d51b
commit
a54f1e2bc5
@ -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_likes', function (Blueprint $table) {
|
||||
$schema->table('post_likes', function (Blueprint $table) use ($schema) {
|
||||
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('post_likes', function (Blueprint $table) {
|
||||
$schema->table('post_likes', function (Blueprint $table) use ($schema) {
|
||||
$table->dropForeign(['post_id', 'user_id']);
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user