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'); }