Skip to content

Commit

Permalink
Merge pull request #1415 from jonasraoni/bugfix/main/9039-drop-deprec…
Browse files Browse the repository at this point in the history
…ated-fields

Bugfix/main/9039 drop deprecated fields
  • Loading branch information
jonasraoni authored Jun 2, 2023
2 parents c010934 + ee76136 commit 691d418
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
4 changes: 0 additions & 4 deletions classes/migration/install/OMPMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ public function up(): void
$table->foreign('publication_id', 'publication_formats_publication_id')->references('publication_id')->on('publications')->onDelete('cascade');
$table->index(['publication_id'], 'publication_formats_publication_id');

// DEPRECATED: Held over for the OJS 2.x to 3. upgrade process pkp/pkp-lib#3572
$table->bigInteger('submission_id')->nullable();
$table->index(['submission_id'], 'publication_format_submission_id');

$table->smallInteger('physical_format')->default(1)->nullable();
$table->string('entry_key', 64)->nullable();
$table->float('seq', 8, 2)->default(0);
Expand Down
5 changes: 0 additions & 5 deletions classes/migration/upgrade/v3_4_0/I6093_AddForeignKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,6 @@ public function up(): void
$table->index(['submission_id'], 'representatives_submission_id');
});

Schema::table('publication_formats', function (Blueprint $table) {
$table->foreign('submission_id')->references('submission_id')->on('submissions')->onDelete('cascade');
$table->index(['submission_id'], 'publication_formats_submission_id');
});

Schema::table('features', function (Blueprint $table) {
$table->foreign('submission_id')->references('submission_id')->on('submissions')->onDelete('cascade');
$table->index(['submission_id'], 'features_submission_id');
Expand Down
39 changes: 39 additions & 0 deletions classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/**
* @file classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php
*
* Copyright (c) 2023 Simon Fraser University
* Copyright (c) 2023 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I9039_DropDeprecatedFields
*
* @brief Drop deprecated fields
*/

namespace APP\migration\upgrade\v3_4_0;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class I9039_DropDeprecatedFields extends \PKP\migration\upgrade\v3_4_0\I9039_DropDeprecatedFields
{
/**
* Run the migration.
*/
public function up(): void
{
parent::up();

// Release the index assigned to the column before dropping it
if (DB::getDoctrineSchemaManager()->introspectTable('publication_formats')->hasIndex('publication_format_submission_id')) {
Schema::table('publication_formats', fn (Blueprint $table) => $table->dropIndex('publication_format_submission_id'));
}

if (Schema::hasColumn('publication_formats', 'submission_id')) {
Schema::dropColumns('publication_formats', 'submission_id');
}
}
}
1 change: 1 addition & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
<migration class="PKP\migration\upgrade\v3_4_0\I8866_DispatchRegionCodesFixingJobs"/>
<migration class="APP\migration\upgrade\v3_4_0\I8992_FixEmptyUrlPaths"/>
<migration class="APP\migration\upgrade\v3_4_0\I9040_DropSettingType"/>
<migration class="APP\migration\upgrade\v3_4_0\I9039_DropDeprecatedFields"/>
<data file="dbscripts/xml/upgrade/3.4.0_preupdate_email_templates.xml" />
<note file="docs/release-notes/README-3.4.0" />
</upgrade>
Expand Down

0 comments on commit 691d418

Please sign in to comment.