From 0084b48d86923e46ab6a72c9f28b5c2a2e9b83e2 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Wed, 16 Dec 2020 20:38:21 -0800 Subject: [PATCH] quick migration changes for refresh(ish) support; ref #2875 This still fails in a 2017 migration, but I don't care. --- .../2019_03_02_151321_fix_unique_index_to_account_for_host.php | 2 ++ ...2020_03_22_163911_merge_permissions_table_into_subusers.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/database/migrations/2019_03_02_151321_fix_unique_index_to_account_for_host.php b/database/migrations/2019_03_02_151321_fix_unique_index_to_account_for_host.php index fe5f85f88..59425aee7 100644 --- a/database/migrations/2019_03_02_151321_fix_unique_index_to_account_for_host.php +++ b/database/migrations/2019_03_02_151321_fix_unique_index_to_account_for_host.php @@ -30,6 +30,8 @@ class FixUniqueIndexToAccountForHost extends Migration public function down() { Schema::table('databases', function (Blueprint $table) { + $table->dropForeign(['database_host_id']); + $table->dropUnique(['database_host_id', 'database']); $table->dropUnique(['database_host_id', 'username']); diff --git a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php index f46481b47..b40f4f55d 100644 --- a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php +++ b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php @@ -108,7 +108,8 @@ class MergePermissionsTableIntoSubusers extends Migration foreach (DB::select('SELECT id, permissions FROM subusers') as $datum) { $values = []; foreach (json_decode($datum->permissions, true) as $permission) { - if (! empty($v = $flipped[$permission])) { + $v = $flipped[$permission] ?? null; + if (! empty($v)) { $values[] = $datum->id; $values[] = $v; }