Skip to content

Commit

Permalink
pkp#8598 DB Migration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
defstat committed Feb 14, 2023
1 parent be9f10d commit 3858e1c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function up(): void
// All _settings tables.
$settingsTables = $this->getSettingsTables();
foreach ($settingsTables as $settingsTable => $settingsTableIdColumn) {
if (Schema::hasColumn($settingsTable, 'locale')) {
if (Schema::hasTable($settingsTable) && Schema::hasColumn($settingsTable, 'locale')) {
$settingsValues = DB::table($settingsTable)
->select([$settingsTableIdColumn, 'locale', 'setting_name'])
->get();
Expand All @@ -63,7 +63,7 @@ public function up(): void
->where('setting_name', '=', $settingsValue->setting_name)
->where('locale', '=', $defaultLocale)
->first();

if (is_null($existingDefaultLocaleValue)) {
DB::table($settingsTable)
->where($settingsTableIdColumn, '=', $settingsValue->{$settingsTableIdColumn})
Expand Down Expand Up @@ -416,6 +416,7 @@ protected function getSettingsTables(): Collection
'library_file_settings' => 'file_id',
'navigation_menu_item_assignment_settings' => 'navigation_menu_item_assignment_id',
'navigation_menu_item_settings' => 'navigation_menu_item_id',
'notification_settings' => 'notification_id',
'notification_subscription_settings' => 'setting_id',
'plugin_settings' => 'context_id',
'publication_settings' => 'publication_id',
Expand Down

0 comments on commit 3858e1c

Please sign in to comment.