Upgrading 3.2.1.2 to 3.3.0.7 or 3.3.0.0

ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘files’ already exists (SQL: create table files (file_id bigint unsigned not null auto_increment primary key, path varchar(255) not null, mimetype varchar(255) not null) default character set utf8 collate ‘utf8_general_ci’)

i have deleted this table, and then i have next error:

ERROR: Upgrade failed: DB: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘url’ in ‘field list’ (SQL: select url, navigation_menu_item_id from navigation_menu_items where context_id = 1)

i have few notices:
PHP Warning: Use of undefined constant SCHEMA_GALLEY - assumed ‘SCHEMA_GALLEY’ (this will throw an Error in a future version of PHP) in /home/uars/web/uars.info/public_shtml/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 /home/uars/web/uars.info/public_shtml/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 /home/uars/web/uars.info/public_shtml/lib/pkp/includes/functions.inc.php on line 224

What is procedure of upgrading from 3.2.1.2 ?

PHP version: 7.3.29-1+ubuntu18.04.1+deb.sury.org+1
apache: Apache/2.4.29 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.1.1
mysql: 5.7.35-0ubuntu0.18.04.1

folders-files permissions and ownership are been set:

sudo find . -type d -exec chmod 755 {} +

sudo find . -type f -exec chmod 644 {} +

sudo find . -exec chown uars:uars {} +

i tried to upgrade to 3.3.0.0

but receive next error:

ERROR: Upgrade failed: DB: SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table submission_file_revisions add constraint submission_file_revisions_submission_file_id_foreign foreign key (submission_file_id) references submission_files (submission_file_id))

upgrade to 3.2.1-3 was succesufull

upgrade to 3.2.1-4 was also sucesfull. but when i tied to upgrade to 3.3.0 i receive this messsage:

ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘files’ already exists (SQL: create table files (file_id bigint unsigned not null auto_increment primary key, path varchar(255) not null, mimetype varchar(255) not null) default character set utf8 collate ‘utf8_general_ci’)

as i understand i have some problems with “files” table?

DROP TABLE IF EXISTS files;
CREATE TABLE files (
file_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
path varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
mimetype varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (file_id) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1027 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

Hi @redukr

The “files” table only exists in OJS 3.3. If your upgrade is complaining about it existing already, it sounds like you had a failed upgrade to 3.3 before, and then did not completely restore your database from a backup (you perhaps just reloaded your old one, which would not have dropped the files table). The table should not exist in your database prior to your upgrade to 3.3.

The inability to create foreign keys means that your OJS database user does not have the REFERENCES privilege within MySQL. OJS 3.3 now creates foreign keys in some places and you will need that, as well as also ensure that you’re using InnoDB database tables rather than MyISAM ones. MyISAM tables do not support foreign keys.

Best,
Jason

thank’s for explanation! i have converted all tables to INNODB usage engine.

i have removed “files” table. next error:

as i figured it shows, due to incorrect upgrade
ERROR: Upgrade failed: DB: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘url’ in ‘field list’ (SQL: select url, navigation_menu_item_id from navigation_menu_items where context_id = 1)

i’ve restored DB fron older archive and receive this error:

PHP Notice: Trying to get property ‘primary_locale’ of non-object in /home/uars/web/uars.info/public_shtml/lib/pkp/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php on line 639
PHP Warning: array_values() expects parameter 1 to be array, null given in /home/uars/web/uars.info/public_shtml/lib/pkp/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php on line 187
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Illuminate\Database\Query\Builder::cleanBindings() must be of the type array, null given, called in /home/uars/web/uars.info/public_shtml/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php on line 919 and defined in /home/uars/web/uars.info/public_shtml/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:3088
Stack trace:
#0 /home/uars/web/uars.info/public_shtml/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(919): Illuminate\Database\Query\Builder->cleanBindings(NULL)
#1 /home/uars/web/uars.info/public_shtml/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(946): Illuminate\Database\Query\Builder->whereIn(‘js.locale’, NULL, ‘and’, true)
#2 /home/uars/web/uars.info/public_shtml/lib/pkp/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php(191): Illuminate\Database\Query\Builder->whereNotIn(‘js.locale’, NULL)
#3 /home/uars/web/uars.info/public_shtml/l in /home/uars/web/uars.info/public_shtml/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php on line 3088

root@vesta:/home/uars/web/uars.info/public_shtml# php -d memory_limit=800M tools/upgrade.php check
PHP Warning: Use of undefined constant SCHEMA_GALLEY - assumed ‘SCHEMA_GALLEY’ (this will throw an Error in a future version of PHP) in /home/uars/web/uars.info/public_shtml/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 /home/uars/web/uars.info/public_shtml/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 /home/uars/web/uars.info/public_shtml/lib/pkp/includes/functions.inc.php on line 224
Code version: 3.3.0.7
Database version: 3.2.1.2
Latest version: 3.3.0.7
Database version is older than code version
Run “tools/upgrade.php upgrade” to update

PHP Notice: Trying to get property ‘primary_locale’ of non-object in /home/uars/web/uars.info/public_shtml/lib/pkp/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php on line 669
[migration: OJSv3_3_0UpgradeMigration]
PHP Notice: Undefined property: stdClass::$properties in /home/uars/web/uars.info/public_shtml/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php on line 89
PHP Warning: Invalid argument supplied for foreach() in /home/uars/web/uars.info/public_shtml/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php on line 89
PHP Warning: Creating default object from empty value in /home/uars/web/uars.info/public_shtml/classes/plugins/PubObjectsExportPlugin.inc.php on line 458
[note: docs/release-notes/README-3.3.0]

[code: Installer Installer::addPluginVersions]
[post-install]

but i’ve upgraded :slight_smile: