Upgrade OJS 3.1.2-1 to 3.2.1-4 Successfully upgraded

I upgraded OJS 3.1.2-1 to 3.2.1-4 after some errors. If I did a well done, it can help others.
I managed to get around them, it worked, but I’m not sure I’m right, because after that I could’n upgrade from 3.2.1-4 to 3.3.0-8 version.
Also I could’n upgrade directly from 3.1.2-1 to 3.3.0-8.
First, if you can help me, I’d to know if I did a well work upgrading to 3.2.1-4.
ps: After this topic, I pretend open a new Topic about my upgrading from 3.2.1-4 to 3.3.0-8.

1º ERROR MESSAGE:

        $ php tools/upgrade.php upgrade

        PHP Warning:  Use of undefined constant SCHEMA_GALLEY - assumed 'SCHEMA_GALLEY' (this will throw an Error in a future version of PHP) in ../lib/pkp/includes/functions.inc.php on line 224
        ..........
        ..........
        PHP Warning:  Use of undefined constant SCHEMA_AUTHOR - assumed 'SCHEMA_AUTHOR' (this will throw an Error in a future version of PHP) in ../lib/pkp/includes/functions.inc.php on line 224
        ..........
        ..........
        PHP Warning:  Use of undefined constant SCHEMA_AUTHOR - assumed 'SCHEMA_AUTHOR' (this will throw an Error in a future version of PHP) in ../lib/pkp/includes/functions.inc.php on line 224
        ..........
        ..........
        [pre-install]
        [load: upgrade.xml]
        [version: 3.2.1.4]
        [code: Installer Installer::checkPhpVersion]
        [code: Installer Installer::migrateSubmissionCoverImages]
        [data: dbscripts/xml/upgrade/3.2.0_preupdate_email_templates.xml]
        [data: dbscripts/xml/upgrade/3.2.0_preupdate_versioning_articleGalleySettings.xml]
        ERROR: Upgrade failed: DB: Table 'submission_galley_settings' already exists

1º ERROR SOLUTION:
drop table submission_galley_settings;

2º ERROR MESSAGE: (after restoure the database and apply the 1º solution)

      $ php tools/upgrade.php upgrade
        ..........
        ..........
        [data: dbscripts/xml/upgrade/3.2.0_preupdate_versioning_articleGalleySettings.xml]
        [data: dbscripts/xml/upgrade/3.2.0_preupdate_versioning.xml]
        [data: dbscripts/xml/upgrade/3.2.0_preupdate_last_activity.xml]
        [data: dbscripts/xml/upgrade/3.2.1_preupdate_subeditor_categories.xml]
        [schema: lib/pkp/xml/schema/common.xml]
        [schema: lib/pkp/xml/schema/log.xml]
        [schema: lib/pkp/xml/schema/announcements.xml]
        [schema: lib/pkp/xml/schema/scheduledTasks.xml]
        [schema: lib/pkp/xml/schema/temporaryFiles.xml]
        [schema: lib/pkp/xml/schema/metadata.xml]
        [schema: lib/pkp/xml/schema/reviews.xml]
        [schema: lib/pkp/xml/schema/reviewForms.xml]
        [schema: lib/pkp/xml/schema/controlledVocab.xml]
        [schema: lib/pkp/xml/schema/submissions.xml]
        [schema: lib/pkp/xml/schema/submissionFiles.xml]
        [schema: lib/pkp/xml/schema/categories.xml]
        [schema: lib/pkp/xml/schema/notes.xml]
        [schema: lib/pkp/xml/schema/genres.xml]
        [schema: lib/pkp/xml/schema/tombstone.xml]
        [schema: lib/pkp/xml/schema/rolesAndUserGroups.xml]
        [schema: lib/pkp/xml/schema/metrics.xml]
        [schema: lib/pkp/xml/schema/views.xml]
        [schema: lib/pkp/xml/schema/libraryFiles.xml]
        [schema: lib/pkp/xml/schema/navigationMenus.xml]
        [schema: dbscripts/xml/ojs_schema.xml]
        [data: dbscripts/xml/indexes.xml]
        [code: Installer Installer::installDefaultNavigationMenus]
        WARNING: The NavigationMenu (ContextId: 20, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
        WARNING: The NavigationMenu (ContextId: 20, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
        ..........
        ..........
        WARNING: The NavigationMenu (ContextId: 9, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
        WARNING: The NavigationMenu (ContextId: 0, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
        [code: Installer Installer::migrateStaticPagesToNavigationMenuItems]
        [code: Installer Installer::migrateUserAndAuthorNames (skipped)]
        [data: dbscripts/xml/upgrade/3.2.0_stylesheet.xml]
        [data: dbscripts/xml/upgrade/3.2.0_archiving_settings.xml]
        [data: dbscripts/xml/upgrade/3.2.0_update.xml]
        [data: dbscripts/xml/upgrade/3.2.0_navigation_menu_items_locale_change.xml]
        [code: Installer Installer::migrateSiteLocales]
        [code: Installer Installer::migrateSidebarBlocks]
        [code: Installer Installer::migrateSiteStylesheet]
        [code: Installer Installer::migrateMetadataSettings]
        [code: Installer Installer::createLicenseTerms]
        [code: Installer Installer::installEmailTemplate]
        [code: Installer Installer::changeUserRolesAndStageAssignmentsForStagePermitSubmissionEdit]
        [data: dbscripts/xml/upgrade/3.2.0_versioning.xml]
        ERROR: Upgrade failed: DB: Column 'publication_id' cannot be null

2º ERROR SOLUTION:

Include code in the file
dbscripts/xml/upgrade/3.2.0_versioning.xml
before and after query execution where be the error (line 186):

           <query driver="mysql,mysqli">
               UPDATE citations as c
  1. Include before:
            <query driver="mysql,mysqli">ALTER TABLE citations MODIFY publication_id bigint(20) DEFAULT 0;</query>
  1. Include atfer:
            <query driver="mysql,mysqli">DELETE FROM citations WHERE publication_id IS NULL;</query>
            <query driver="mysql,mysqli">ALTER TABLE citations MODIFY publication_id bigint(20) NOT NULL DEFAULT 0;</query>

3º ERROR MESSAGE: (after restoure the database and apply the 1º and 2º solutions)

        $ php tools/upgrade.php upgrade
        ..........
        ..........
        [data: dbscripts/xml/upgrade/3.2.0_versioning.xml]
        [data: dbscripts/xml/upgrade/3.2.0_versioning_submissionCategories.xml]
        [data: dbscripts/xml/upgrade/3.2.0_last_activity.xml]
        [data: dbscripts/xml/upgrade/3.2.0_url_path.xml]
        ERROR: Upgrade failed: DB: Data too long for column 'url_path' at row 2

3º ERROR SOLUTION:

Cut excess texts when importing, in the file:
dbscripts/xml/upgrade/3.2.0_url_path.xml

  1. Change the line (29):

SELECT ist.setting_value

To:

SELECT SUBSTR(ist.setting_value, 1, 64)
  1. Change the line (38):

SELECT igs.setting_value

To:

SELECT SUBSTR(igs.setting_value, 1, 64)
  1. Change the line (47):

SELECT gs.setting_value

To:

SELECT SUBSTR(gs.setting_value, 1, 64)

Can someone comment my solution if I’m right or I can improve (how) ?

3 Likes

Thanks a lot to share your tips @murilodbva.

This is the kind of collaborative actitude I love to see in the forum of the community instead of the usual “I break something. Now you must help me.”

1 Like

@asmecher do you have some comment, please? :slightly_smiling_face:
Am I correct with that solution?

Hi @murilodbva,

Starting from the top, is this a full error message or it’s truncated?

PHP Warning:  Use of undefined constant SCHEMA_GALLEY - assumed 'SCHEMA_GALLEY' (this will throw an Error in a future version of PHP) in ../lib/pkp/includes/functions.inc.php on line 224

Can you double-check that you are running upgrade from a back-up? This message

indicates that you have 2 tables, submission_galley_settings and article_galley_settings, which leans me towards the thought that in the previous upgrade attempt, after the former table was created, the upgrade have failed, before dropping the latter table; thus, all subsequent attempts were made on this, partially upgraded, database.

1 Like

For this two, see: [OMP] Error upgrading from version 3.1.2-4 to 3.2.0 · Issue #5583 · pkp/pkp-lib · GitHub

1 Like

I’ve seen this thread referred to a number of times. Unfortunately there are multiple problems and (possible) solutions in the thread. It would be more helpful at least to specify which fix you think would be most appropriate. I tried all of them and they did not work for the situation that I find myself in here Error upgrade failed OJS 3.1.2-4 to OJS 3.3.0-8 - #2 by jamilj.

That said, it seems like the the changes suggested by @murilodbva are much too extensive for most users to try. IMO, they are suggestions that should be made in github, not here. In the past, fixing one or two errors has had a cascading effect. However, I wonder if the main issue I’m having is the large jump between versions.

It would be fantastic to develop a more seamless update method—i.e., an update tool—that would encourage users to make updates on a more regular basis. Though I realize this is difficult for open source projects in general.

1 Like

I anticipate that upgrades from 3.3 - 3.4 are going to be more error-proof with the adaption of a new migration tool and patterns.

Hi @Vitaliy , sorry for long delay to reponse you.

  1. Yes, it’s truncated. I removed personal folder’s names.

  2. Very thanks for your opinion. It made sense for me.

Hi there.
I discovered a bug now after that upgrad. So sorry. :sleepy: :see_no_evil:
I posted about in this topic: https://forum.pkp.sfu.ca/t/php-fatal-error-uncaught-error-call-to-a-member-function-getoption-on-null-after-upgrade-from-3-1-2-1-to-3-2-1-4/72272/8

I’m investigating to solve.

With very happy, I come to inform the real solution for 1º ERROR :heart_eyes::

Include condition for create table in the file:
dbscripts/xml/upgrade/3.2.0_preupdate_versioning_articleGalleySettings.xml

Before:
<query>CREATE TABLE submission_galley_settings ..

After:
<query>CREATE TABLE IF NOT EXISTS submission_galley_settings ..

PS.: I tried to fix the response for 1º ERROR on top for this post, but it was not possible.

1 Like

Hi @murilodbva,

Thanks for your proposal! I’ve linked to this thread from:

…where the same issue is described. Hopefully we’ll get feedback from someone who encounters this issue during an upgrade, and they can confirm.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like