1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 09:26:34 +02:00

revert the fix index names logic, preparing for illuminate 5.7

This commit is contained in:
Daniël Klabbers
2019-01-15 21:03:12 +01:00
parent 8aab6111ec
commit b20d590289
2 changed files with 4 additions and 14 deletions

View File

@@ -9,7 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder; use Illuminate\Database\Schema\Builder;
@@ -31,20 +30,16 @@ return [
}) })
->update(['user_id' => null]); ->update(['user_id' => null]);
$schema->table('flags', function (Blueprint $table) use ($schema) { $schema->table('flags', function (Blueprint $table) {
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade'); $table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
Migration::fixIndexNames($schema, $table);
}); });
}, },
'down' => function (Builder $schema) { 'down' => function (Builder $schema) {
$schema->table('flags', function (Blueprint $table) use ($schema) { $schema->table('flags', function (Blueprint $table) {
$table->dropForeign(['post_id']); $table->dropForeign(['post_id']);
$table->dropForeign(['user_id']); $table->dropForeign(['user_id']);
Migration::fixIndexNames($schema, $table);
}); });
} }
]; ];

View File

@@ -9,24 +9,19 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder; use Illuminate\Database\Schema\Builder;
return [ return [
'up' => function (Builder $schema) { 'up' => function (Builder $schema) {
$schema->table('flags', function (Blueprint $table) use ($schema) { $schema->table('flags', function (Blueprint $table) {
$table->index('created_at'); $table->index('created_at');
Migration::fixIndexNames($schema, $table);
}); });
}, },
'down' => function (Builder $schema) { 'down' => function (Builder $schema) {
$schema->table('flags', function (Blueprint $table) use ($schema) { $schema->table('flags', function (Blueprint $table) {
$table->dropIndex(['created_at']); $table->dropIndex(['created_at']);
Migration::fixIndexNames($schema, $table);
}); });
} }
]; ];