From 7a07f38d4492063eb4a55477e2ea3cbc30870b41 Mon Sep 17 00:00:00 2001 From: Jonas Raoni Soares da Silva Date: Thu, 1 Jun 2023 13:27:44 +0300 Subject: [PATCH 1/5] pkp/pkp-lib#9039 Dropped field from table creation --- classes/migration/install/OMPMigration.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/classes/migration/install/OMPMigration.php b/classes/migration/install/OMPMigration.php index 5180877f2cb..bb93fa74e47 100644 --- a/classes/migration/install/OMPMigration.php +++ b/classes/migration/install/OMPMigration.php @@ -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); From 528970aaa3d981d4d1fa3eb9f24886e059fe2066 Mon Sep 17 00:00:00 2001 From: Jonas Raoni Soares da Silva Date: Thu, 1 Jun 2023 13:28:37 +0300 Subject: [PATCH 2/5] pkp/pkp-lib#9039 Prevented creation of useless foreign key --- classes/migration/upgrade/v3_4_0/I6093_AddForeignKeys.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/classes/migration/upgrade/v3_4_0/I6093_AddForeignKeys.php b/classes/migration/upgrade/v3_4_0/I6093_AddForeignKeys.php index 5f279dbffc0..d86cf72f1be 100644 --- a/classes/migration/upgrade/v3_4_0/I6093_AddForeignKeys.php +++ b/classes/migration/upgrade/v3_4_0/I6093_AddForeignKeys.php @@ -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'); From 8a154c97e1abf524d6b9f10470ce1b9669f8964a Mon Sep 17 00:00:00 2001 From: Jonas Raoni Soares da Silva Date: Thu, 1 Jun 2023 13:29:19 +0300 Subject: [PATCH 3/5] pkp/pkp-lib#9039 Added migration --- .../v3_4_0/I9039_DropDeprecatedFields.php | 41 +++++++++++++++++++ dbscripts/xml/upgrade.xml | 1 + 2 files changed, 42 insertions(+) create mode 100644 classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php diff --git a/classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php b/classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php new file mode 100644 index 00000000000..608706c4140 --- /dev/null +++ b/classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php @@ -0,0 +1,41 @@ + $table->dropIndex('publication_format_submission_id')); + } catch (Exception $e) { + $this->_installer->log("Failed to remove the index publication_format_submission_id from the entity publication_formats, we'll assume it doesn't exist and proceed"); + } + + if (Schema::hasColumn('publication_formats', 'submission_id')) { + Schema::dropColumns('publication_formats', 'submission_id'); + } + } +} diff --git a/dbscripts/xml/upgrade.xml b/dbscripts/xml/upgrade.xml index a36b5e56eea..f078e57a95a 100644 --- a/dbscripts/xml/upgrade.xml +++ b/dbscripts/xml/upgrade.xml @@ -173,6 +173,7 @@ + From cdd81e60cf80f8e7d725337805a3134c0e0a73b3 Mon Sep 17 00:00:00 2001 From: Jonas Raoni Soares da Silva Date: Thu, 1 Jun 2023 13:29:55 +0300 Subject: [PATCH 4/5] pkp/pkp-lib#9040 Replaced try/catch by a check --- .../migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php b/classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php index 608706c4140..814c5f52fd1 100644 --- a/classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php +++ b/classes/migration/upgrade/v3_4_0/I9039_DropDeprecatedFields.php @@ -14,8 +14,8 @@ namespace APP\migration\upgrade\v3_4_0; -use Exception; 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 @@ -28,10 +28,8 @@ public function up(): void parent::up(); // Release the index assigned to the column before dropping it - try { + if (DB::getDoctrineSchemaManager()->introspectTable('publication_formats')->hasIndex('publication_format_submission_id')) { Schema::table('publication_formats', fn (Blueprint $table) => $table->dropIndex('publication_format_submission_id')); - } catch (Exception $e) { - $this->_installer->log("Failed to remove the index publication_format_submission_id from the entity publication_formats, we'll assume it doesn't exist and proceed"); } if (Schema::hasColumn('publication_formats', 'submission_id')) { From ee76136e4ef0087dbe0b8da131ed7b5c7c143717 Mon Sep 17 00:00:00 2001 From: Jonas Raoni Soares da Silva Date: Fri, 2 Jun 2023 13:00:06 +0300 Subject: [PATCH 5/5] pkp/pkp-lib#9039 Submodule update ##jonasraoni/bugfix/main/9039-drop-deprecated-fields## --- lib/pkp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pkp b/lib/pkp index f98e7b29d78..cda21bdae1b 160000 --- a/lib/pkp +++ b/lib/pkp @@ -1 +1 @@ -Subproject commit f98e7b29d78ab54294dcc844ec51ac6236204f2e +Subproject commit cda21bdae1b41993c7ae1863204e7d9d0fb2f63a