mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 13:37:13 +08:00
decided to leave the posts.discussion_id foreign key constraint to discussions out for now
This commit is contained in:
parent
aca0f3c57a
commit
cbc95e42dd
@ -26,9 +26,9 @@ return [
|
||||
$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('user_id')->references('id')->on('users')->onDelete('set null');
|
||||
$table->foreign('last_posted_user_id')->references('id')->on('users')->onDelete('set null');
|
||||
$table->foreign('hidden_user_id')->references('id')->on('users')->onDelete('set null');
|
||||
$table->foreign('first_post_id')->references('id')->on('posts');
|
||||
$table->foreign('last_post_id')->references('id')->on('posts');
|
||||
});
|
||||
|
@ -18,7 +18,7 @@ return [
|
||||
$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('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('discussion_id')->references('id')->on('discussions')->onDelete('cascade');
|
||||
});
|
||||
},
|
||||
|
@ -11,4 +11,4 @@
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
|
||||
return Migration::renameTable('permissions', 'groups_permissions');
|
||||
return Migration::renameTable('permissions', 'group_permission');
|
||||
|
@ -24,10 +24,9 @@ return [
|
||||
|
||||
$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');
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
|
||||
$table->foreign('edited_user_id')->references('id')->on('users')->onDelete('set null');
|
||||
$table->foreign('hidden_user_id')->references('id')->on('users')->onDelete('set null');
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -14,14 +14,14 @@ use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$schema->table('groups_permissions', function (Blueprint $table) {
|
||||
$schema->table('group_permission', 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');
|
||||
$schema->table('group_permission', function (Blueprint $table) {
|
||||
$table->dropForeign('group_permission_group_id_foreign');
|
||||
});
|
||||
}
|
||||
];
|
@ -400,7 +400,7 @@ class Discussion extends AbstractModel
|
||||
*/
|
||||
public function readers()
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'discussions_users');
|
||||
return $this->belongsToMany(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ class Group extends AbstractModel
|
||||
*/
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'users_groups');
|
||||
return $this->belongsToMany(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ class Permission extends AbstractModel
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $table = 'groups_permissions';
|
||||
protected $table = 'group_permission';
|
||||
|
||||
/**
|
||||
* Define the relationship with the group that this permission is for.
|
||||
|
Loading…
x
Reference in New Issue
Block a user