-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade script to rename editorialTeam into editorialHistory and to r…
…emove Editorial Team manu nav item
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
classes/migration/upgrade/v3_5_0/I9937_EditorialTeamToEditorialHistory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/** | ||
* @file classes/migration/upgrade/v3_5_0/I9937_EditorialTeamToEditorialHistory.php | ||
* | ||
* Copyright (c) 2024 Simon Fraser University | ||
* Copyright (c) 2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class I9937_EditorialTeamToEditorialHistory | ||
* | ||
* @brief Migrate/rename editorialTeam to editorialHistory context setting and remove Editorial Team navigation menu item. | ||
*/ | ||
|
||
namespace PKP\migration\upgrade\v3_5_0; | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use PKP\install\DowngradeNotSupportedException; | ||
use PKP\migration\Migration; | ||
|
||
abstract class I9937_EditorialTeamToEditorialHistory extends Migration | ||
{ | ||
abstract protected function getContextSettingsTable(): string; | ||
|
||
/** | ||
* Run the migration. | ||
*/ | ||
public function up(): void | ||
{ | ||
DB::table($this->getContextSettingsTable()) | ||
->where('setting_name', '=', 'editorialTeam') | ||
->update(['setting_name' => 'editorialHistory']); | ||
|
||
// Because of the foreign keys constrains it is enough to | ||
// only remove the entries from the table navigation_menu_items. | ||
DB::table('navigation_menu_items') | ||
->where('type', 'NMI_TYPE_EDITORIAL_TEAM') | ||
->delete(); | ||
} | ||
|
||
/** | ||
* Reverse the migration | ||
*/ | ||
public function down(): void | ||
{ | ||
throw new DowngradeNotSupportedException(); | ||
} | ||
} |