mirror of
https://github.com/flarum/framework.git
synced 2024-11-30 05:13:37 +08:00
Use new shortcuts for migrations
This commit is contained in:
parent
ec0054cace
commit
d240d4c0ff
|
@ -8,19 +8,14 @@
|
||||||
* 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;
|
|
||||||
|
|
||||||
return [
|
return Migration::createTable(
|
||||||
'up' => function (Builder $schema) {
|
'discussions_tags',
|
||||||
$schema->create('discussions_tags', function (Blueprint $table) {
|
function (Blueprint $table) {
|
||||||
$table->integer('discussion_id')->unsigned();
|
$table->integer('discussion_id')->unsigned();
|
||||||
$table->integer('tag_id')->unsigned();
|
$table->integer('tag_id')->unsigned();
|
||||||
$table->primary(['discussion_id', 'tag_id']);
|
$table->primary(['discussion_id', 'tag_id']);
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
'down' => function (Builder $schema) {
|
|
||||||
$schema->drop('discussions_tags');
|
|
||||||
}
|
}
|
||||||
];
|
);
|
||||||
|
|
|
@ -8,21 +8,16 @@
|
||||||
* 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;
|
|
||||||
|
|
||||||
return [
|
return Migration::createTable(
|
||||||
'up' => function (Builder $schema) {
|
'users_tags',
|
||||||
$schema->create('users_tags', function (Blueprint $table) {
|
function (Blueprint $table) {
|
||||||
$table->integer('user_id')->unsigned();
|
$table->integer('user_id')->unsigned();
|
||||||
$table->integer('tag_id')->unsigned();
|
$table->integer('tag_id')->unsigned();
|
||||||
$table->dateTime('read_time')->nullable();
|
$table->dateTime('read_time')->nullable();
|
||||||
$table->boolean('is_hidden')->default(0);
|
$table->boolean('is_hidden')->default(0);
|
||||||
$table->primary(['user_id', 'tag_id']);
|
$table->primary(['user_id', 'tag_id']);
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
'down' => function (Builder $schema) {
|
|
||||||
$schema->drop('users_tags');
|
|
||||||
}
|
}
|
||||||
];
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user