From 4ab82a8aa03af5d164a390785373e8b46d4bdd96 Mon Sep 17 00:00:00 2001 From: Alexander Suvorov Date: Tue, 29 Dec 2020 20:11:57 +0300 Subject: [PATCH] Hot fix for -- Rebuild group default Space Mapping #4586 (#4732) #4586 corrected migration - delete foreign key. --- .../m201025_095247_spaces_of_users_group.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/protected/humhub/modules/user/migrations/m201025_095247_spaces_of_users_group.php b/protected/humhub/modules/user/migrations/m201025_095247_spaces_of_users_group.php index 78e94a3177..db441a0b54 100644 --- a/protected/humhub/modules/user/migrations/m201025_095247_spaces_of_users_group.php +++ b/protected/humhub/modules/user/migrations/m201025_095247_spaces_of_users_group.php @@ -1,6 +1,7 @@ dropColumn('group', 'space_id'); + try { + $this->dropForeignKey('fk_group-space_id', 'group'); + } catch (\Exception $e) { + } + $this->safeDropColumn('group', 'space_id'); } /** @@ -46,6 +51,8 @@ class m201025_095247_spaces_of_users_group extends Migration */ public function safeDown() { + $this->addColumn('group', 'space_id', $this->integer(10)->defaultValue(null)); + $this->addForeignKey('fk_group-space_id', 'group', 'space_id', 'space', 'id', 'CASCADE', 'CASCADE'); $this->dropTable('group_space'); }