Skip to content

Commit

Permalink
pkp/pkp-lib#10874 Remove submission stage ID from user_group_stage du…
Browse files Browse the repository at this point in the history
…ring migration
  • Loading branch information
Vitaliy-1 committed Feb 11, 2025
1 parent 012e900 commit 1228378
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/**
* @file classes/migration/upgrade/v3_5_0/I10874_UserGroupStagesRemoveSubmission.php
*
* Copyright (c) 2025 Simon Fraser University
* Copyright (c) 2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I10874_UserGroupStagesRemoveSubmission
*
* @brief Remove WORKFLOW_STAGE_ID_SUBMISSION stage from user_group_stage table
*/

namespace APP\migration\upgrade\v3_5_0;

use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use PKP\migration\Migration;

class I10874_UserGroupStagesRemoveSubmission extends Migration
{
public const WORKFLOW_STAGE_SUBMISSION = 1;

protected Collection $rowsWithSubmissionStage;

public function up(): void
{
$this->rowsWithSubmissionStage = DB::table('user_group_stage')
->where('stage_id', self::WORKFLOW_STAGE_SUBMISSION)
->get();

DB::table('user_group_stage')->where('stage_id', self::WORKFLOW_STAGE_SUBMISSION)->delete();
}

public function down(): void
{
$toInsert = [];
foreach ($this->rowsWithSubmissionStage as $row) { /* @var \stdClass $row */
$toInsert[] = [
'context_id' => $row->context_id,
'user_group_id' => $row->user_group_id,
'stage_id' => $row->stage_id,
];
}

DB::table('user_group_stage')->insert($toInsert);
}
}
1 change: 1 addition & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<migration class="PKP\migration\upgrade\v3_5_0\I7135_CreateNewRorRegistryCacheTables"/>
<migration class="PKP\migration\upgrade\v3_5_0\I10759_AddReviewAssignmentSettings"/>
<migration class="PKP\migration\upgrade\v3_5_0\I10819_OrcidOauthScopeMail"/>
<migration class="APP\migration\upgrade\v3_5_0\I10874_UserGroupStagesRemoveSubmission"/>
<note file="docs/release-notes/README-3.5.0" />
</upgrade>

Expand Down

0 comments on commit 1228378

Please sign in to comment.