mirror of
https://github.com/flarum/framework.git
synced 2024-12-03 07:33:36 +08:00
added constraints, discussions_first_post_id_foreign blocks here
This commit is contained in:
parent
ccd4729011
commit
aca0f3c57a
|
@ -19,6 +19,8 @@ return [
|
|||
$table->renameColumn('lifetime', 'lifetime_seconds');
|
||||
$table->renameColumn('last_activity', 'last_activity_at');
|
||||
$table->dateTime('created_at');
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -28,6 +30,8 @@ return [
|
|||
$table->renameColumn('last_activity_at', 'last_activity');
|
||||
$table->dropColumn('created_at');
|
||||
$table->renameColumn('token', 'id');
|
||||
|
||||
$table->dropForeign('access_tokens_user_id_foreign');
|
||||
});
|
||||
}
|
||||
];
|
||||
|
|
|
@ -25,6 +25,12 @@ return [
|
|||
$table->renameColumn('last_user_id', 'last_posted_user_id');
|
||||
$table->renameColumn('hide_time', 'hidden_at');
|
||||
$table->renameColumn('hide_user_id', 'hidden_user_id');
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->foreign('last_posted_user_id')->references('id')->on('users');
|
||||
$table->foreign('hidden_user_id')->references('id')->on('users');
|
||||
$table->foreign('first_post_id')->references('id')->on('posts');
|
||||
$table->foreign('last_post_id')->references('id')->on('posts');
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -40,6 +46,11 @@ return [
|
|||
$table->renameColumn('last_posted_user_id', 'last_user_id');
|
||||
$table->renameColumn('hidden_at', 'hide_time');
|
||||
$table->renameColumn('hidden_user_id', 'hide_user_id');
|
||||
|
||||
$table->dropForeign([
|
||||
'discussions_user_id_foreign', 'discussions_last_posted_user_id', 'hidden_user_id',
|
||||
'first_post_id', 'last_post_id'
|
||||
]);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
|
|
@ -17,6 +17,9 @@ return [
|
|||
$schema->table('discussions_users', function (Blueprint $table) {
|
||||
$table->renameColumn('read_time', 'last_read_at');
|
||||
$table->renameColumn('read_number', 'last_read_post_number');
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->foreign('discussion_id')->references('id')->on('discussions')->onDelete('cascade');
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -24,6 +27,8 @@ return [
|
|||
$schema->table('discussions_users', function (Blueprint $table) {
|
||||
$table->renameColumn('last_read_at', 'read_time');
|
||||
$table->renameColumn('last_read_post_number', 'read_number');
|
||||
|
||||
$table->dropForeign(['discussions_users_user_id_foreign', 'discussions_users_discussion_id_foreign']);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$schema->table('email_tokens', function (Blueprint $table) {
|
||||
$table->renameColumn('id', 'token');
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('email_tokens', function (Blueprint $table) {
|
||||
$table->renameColumn('token', 'id');
|
||||
|
||||
$table->dropForeign('email_tokens_user_id_foreign');
|
||||
});
|
||||
}
|
||||
];
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
|
||||
return Migration::renameColumn('email_tokens', 'id', 'token');
|
|
@ -21,6 +21,8 @@ return [
|
|||
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
|
||||
$schema->getConnection()->table('notifications')
|
||||
|
@ -46,6 +48,8 @@ return [
|
|||
|
||||
$table->boolean('is_read');
|
||||
$table->boolean('is_deleted');
|
||||
|
||||
$table->dropForeign('notifications_user_id_foreign');
|
||||
});
|
||||
|
||||
$schema->getConnection()->table('notifications')
|
||||
|
|
|
@ -23,6 +23,11 @@ return [
|
|||
$table->renameColumn('hide_user_id', 'hidden_user_id');
|
||||
|
||||
$table->longText('content')->change();
|
||||
|
||||
$table->foreign('discussion_id')->references('id')->on('discussions')->onDelete('cascade');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->foreign('edited_user_id')->references('id')->on('users');
|
||||
$table->foreign('hidden_user_id')->references('id')->on('users');
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -36,6 +41,11 @@ return [
|
|||
$table->renameColumn('edited_user_id', 'hidden_user_id');
|
||||
|
||||
$table->mediumText('content')->change();
|
||||
|
||||
$table->dropForeign([
|
||||
'posts_user_id_foreign', 'posts_discussion_id_foreign',
|
||||
'posts_edited_user_id_foreign', 'posts_hidden_user_id_foreign'
|
||||
]);
|
||||
});
|
||||
}
|
||||
];
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$schema->table('group_user', function (Blueprint $table) {
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('group_id')->references('id')->on('groups')->onDelete('cascade');
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('group_user', function (Blueprint $table) {
|
||||
$table->dropForeign(['group_user_user_id_foreign', 'group_user_group_id_foreign']);
|
||||
});
|
||||
}
|
||||
];
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$schema->table('groups_permissions', function (Blueprint $table) {
|
||||
$table->foreign('group_id')->references('id')->on('groups')->onDelete('cascade');
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('group_user', function (Blueprint $table) {
|
||||
$table->dropForeign('group_user_group_id_foreign');
|
||||
});
|
||||
}
|
||||
];
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$schema->table('password_tokens', function (Blueprint $table) {
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('password_tokens', function (Blueprint $table) {
|
||||
$table->dropForeign('password_tokens_user_id_foreign');
|
||||
});
|
||||
}
|
||||
];
|
Loading…
Reference in New Issue
Block a user