Skip to content

Commit

Permalink
upgrade script to rename editorialTeam into editorialHistory and to r…
Browse files Browse the repository at this point in the history
…emove Editorial Team manu nav item
  • Loading branch information
bozana committed May 7, 2024
1 parent a840a73 commit e4be1cd
Showing 1 changed file with 48 additions and 0 deletions.
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();
}
}

0 comments on commit e4be1cd

Please sign in to comment.