Hi everyone.
I am struggling with an upgrade process of my installation of OMP. I started with this process from OMP 3.1.2.4, solving one problem after another making some changes into the database and other changes into the dbscripts of the OMP installer, etc. Finally I came to OMP 3.2.1-4 with and incremental upgrade process passing by OMP 3.2.0.
OMP 3.2.1-4 is now working fine, nothing seems to be lost in the database.
The steps that I followed in order to upgrade from one version to another were:
- Backup the origin database (mysqldump of the 3.2.1-4 database) and backup the public directory.
- Uncompress the omp installer into a new web server directory and copy the backup of the public directory into it.
- Edit the config.inc.php file with the options that I use (installed=Off, base_url, mysqli, files directory).
- Create a new database and populate it with the backup script.
- Run the upgrade script
php7.4 tools/upgrade.php upgrade
.
The first problem that appears is this:
Database query
alter table `review_files` add constraint `review_files_submission_file_id_foreign` foreign key (`submission_file_id`) references `submission_files` (`submission_file_id`)
[]
ERROR: Upgrade failed: DB: SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'submission_files' (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`))
This problem is solved using the InnoDB engine for the table submission_files
, like this post shows it: Serious issue with Database upgrade (failed from 3.2.1.3 to 3.3.0.2)
ALTER TABLE submission_files ENGINE = InnoDB;
As all we know, it is needed to restart the process (drop database, create database, source backup, etc) and then run the ALTER TABLE line. But after surpass this problem in a new run of the upgrade.php script, a new problem appears:
Database query
select * from `plugin_settings` where `plugin_name` = ? and `setting_name` = ?
["customblockmanagerplugin","blocks"]
Database query
update `plugin_settings` set `setting_value` = ? where `plugin_name` = ? and `setting_name` = ? and `context_id` = ?
["a:7:{i:1;s:7:\"bloquey\";i:2;s:7:\"bloquey\";i:3;s:7:\"bloquez\";i:4;s:7:\"bloquew\";i:5;s:7:\"bloqueq\";i:6;s:6:\"idioma\";i:7;s:9:\"novedades\";}","customblockmanagerplugin","blocks",2]
Database query
select * from `plugin_settings` where `plugin_name` = ? and `setting_name` = ?
["customblockmanagerplugin","blocks"]
Database query
select * from `presses` where `press_id` = ? limit 1
[2]
ERROR: Upgrade failed: DB: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'bloquey-2-blockTitle' for key 'plugin_settings.plugin_settings_pkey' (SQL: insert into `plugin_settings` (`context_id`, `plugin_name`, `setting_name`, `setting_type`, `setting_value`) values (2, bloquey, blockTitle, object, a:1:{s:5:"es_ES";s:7:"bloquey";}), (2, bloquey, blockTitle, object, a:1:{s:5:"es_ES";s:7:"bloquey";}), (2, bloquez, blockTitle, object, a:1:{s:5:"es_ES";s:7:"bloquez";}), (2, bloquew, blockTitle, object, a:1:{s:5:"es_ES";s:7:"bloquew";}), (2, bloqueq, blockTitle, object, a:1:{s:5:"es_ES";s:7:"bloqueq";}), (2, idioma, blockTitle, object, a:1:{s:5:"es_ES";s:6:"idioma";}), (2, novedades, blockTitle, object, a:1:{s:5:"es_ES";s:9:"novedades";}))
That pkey:
blocky-2-blockTitle
is added by the upgrade script, because before that, the table plugin_settings
contains only this records:
mysql> SELECT ps.plugin_name, ps.context_id, ps.setting_name, ps.setting_type FROM plugin_settings AS ps WHERE ps.plugin_name = 'bloquey';
+-------------+------------+--------------+--------------+
| plugin_name | context_id | setting_name | setting_type |
+-------------+------------+--------------+--------------+
| bloquey | 2 | blockContent | object |
| bloquey | 2 | context | int |
| bloquey | 2 | enabled | bool |
| bloquey | 2 | seq | int |
+-------------+------------+--------------+--------------+
4 rows in set (0,00 sec)
But after the script was run, the table contains an additional record (blockTitle):
mysql> SELECT ps.plugin_name, ps.context_id, ps.setting_name, ps.setting_type FROM plugin_settings AS ps WHERE ps.plugin_name = 'bloquey';
+-------------+------------+--------------+--------------+
| plugin_name | context_id | setting_name | setting_type |
+-------------+------------+--------------+--------------+
| bloquey | 2 | blockContent | object |
| bloquey | 2 | blockTitle | object |
| bloquey | 2 | context | int |
| bloquey | 2 | enabled | bool |
| bloquey | 2 | seq | int |
+-------------+------------+--------------+--------------+
5 rows in set (0,00 sec)
I can not find from where this query comes, to see what is going on and try to fix it. So, I need your help with this.
Thanks.