mirror of
https://github.com/flarum/framework.git
synced 2025-04-10 08:40:25 +08:00
revert the fix index names logic, preparing for illuminate 5.7
This commit is contained in:
parent
d4783f4ac5
commit
c18731953d
@ -9,26 +9,21 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$schema->table('tags', function (Blueprint $table) use ($schema) {
|
||||
$schema->table('tags', function (Blueprint $table) {
|
||||
$table->string('slug', 100)->change();
|
||||
$table->unique('slug');
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('tags', function (Blueprint $table) use ($schema) {
|
||||
$schema->table('tags', function (Blueprint $table) {
|
||||
$table->string('slug', 255)->change();
|
||||
$table->dropUnique(['slug']);
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
@ -9,7 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
@ -31,22 +30,18 @@ return [
|
||||
'last_posted_discussion_id' => $select('id', 'discussions', 'last_posted_discussion_id'),
|
||||
]);
|
||||
|
||||
$schema->table('tags', function (Blueprint $table) use ($schema) {
|
||||
$schema->table('tags', function (Blueprint $table) {
|
||||
$table->foreign('parent_id')->references('id')->on('tags')->onDelete('set null');
|
||||
$table->foreign('last_posted_user_id')->references('id')->on('users')->onDelete('set null');
|
||||
$table->foreign('last_posted_discussion_id')->references('id')->on('discussions')->onDelete('set null');
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('tags', function (Blueprint $table) use ($schema) {
|
||||
$schema->table('tags', function (Blueprint $table) {
|
||||
$table->dropForeign(['parent_id']);
|
||||
$table->dropForeign(['last_posted_discussion_id']);
|
||||
$table->dropForeign(['last_posted_user_id']);
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
@ -9,7 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
@ -27,20 +26,16 @@ return [
|
||||
})
|
||||
->delete();
|
||||
|
||||
$schema->table('tag_user', function (Blueprint $table) use ($schema) {
|
||||
$schema->table('tag_user', function (Blueprint $table) {
|
||||
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('tag_user', function (Blueprint $table) use ($schema) {
|
||||
$schema->table('tag_user', function (Blueprint $table) {
|
||||
$table->dropForeign(['tag_id']);
|
||||
$table->dropForeign(['user_id']);
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
@ -9,7 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
@ -27,20 +26,16 @@ return [
|
||||
})
|
||||
->delete();
|
||||
|
||||
$schema->table('discussion_tag', function (Blueprint $table) use ($schema) {
|
||||
$schema->table('discussion_tag', function (Blueprint $table) {
|
||||
$table->foreign('discussion_id')->references('id')->on('discussions')->onDelete('cascade');
|
||||
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('discussion_tag', function (Blueprint $table) use ($schema) {
|
||||
$schema->table('discussion_tag', function (Blueprint $table) {
|
||||
$table->dropForeign(['discussion_id']);
|
||||
$table->dropForeign(['tag_id']);
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user