From 0b250743c9ff714bcaed3db3ed749f27a5460b7e Mon Sep 17 00:00:00 2001 From: Dimitris Efstathiou Date: Wed, 8 Feb 2023 10:03:44 +0200 Subject: [PATCH] pkp/pkp-lib#8598 DB Migration changes --- .../upgrade/v3_4_0/MergeLocalesMigration.php | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php diff --git a/classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php b/classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php new file mode 100644 index 00000000000..71aafee5f77 --- /dev/null +++ b/classes/migration/upgrade/v3_4_0/MergeLocalesMigration.php @@ -0,0 +1,71 @@ +get(); + + foreach ($issueGalleys as $issueGalley) { + $this->updateSingleValueLocale($issueGalley->locale, 'issue_galleys', 'locale', 'galley_id', $issueGalley->galley_id); + } + + // publication_galleys + $publicationGalleys = DB::table('publication_galleys') + ->get(); + + foreach ($publicationGalleys as $publicationGalley) { + $this->updateSingleValueLocale($publicationGalley->locale, 'publication_galleys', 'locale', 'galley_id', $publicationGalley->galley_id); + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + throw new DowngradeNotSupportedException(); + } + + protected function getSettingsTables(): Collection + { + return collect([ + 'issue_galley_settings', + 'issue_settings', + 'journal_settings', + 'publication_galley_settings', + 'section_settings', + 'static_page_settings', + 'subscription_type_settings' + ])->merge(parent::getSettingsTables()); + } +}