I then restored the post 2.2 upgrade database. Then I proceeded to do a regular upgrade.
DBUpdate-to-3.3.sql ran clean.
The resulting DB shows InnoDB for all tables and utf8_general_ci as the collation for all the tables except for the following, which I checked and are explicitly created with utfmb4_unicode_ci collation from the dump script create table statements.
(this is for info only -
None of these tables are involved in the error in step 7)
article
pm_activity
Once everything else checked out I attempted once more to run DBUpdate-to-3.3.pl
Steps 1-6 done - no issues.
Steps 8-13 done - no issues (except the Subroutine Load redefined - no need to worry message in 13 of 13).
Back to step 7 - here are results
******************** results start *****************
Step 7 of 13: Updating Queue Standard Template relations table...
Cleaning queue_standard_template table
Creating new Foreign Keys for queue_standard_template table
--- Note: ---
If you have already run this script before then the Foreign Keys are already set and you might see errors regarding 'duplicate key' or 'constrain already exists', that's fine, no need to worry!
---
ALTER TABLE queue_standard_template ADD CONSTRAINT FK_queue_standard_template_standard_template_id_id FOREIGN KEY (standard_template_id) REFERENCES standard_template (id)
ALTER TABLE queue_standard_template ADD CONSTRAINT FK_queue_standard_template_queue_id_id FOREIGN KEY (queue_id) REFERENCES queue (id)
[Mon Feb 18 15:09:28 2019]
DBUpdate-to-3.3.pl: DBD::mysql::db do failed: Cannot add or update a child row: a foreign key constraint fails (`otrs33`.`#sql-337c_22`, CONSTRAINT `FK_queue_standard_template_queue_id_id` FOREIGN KEY (`queue_id`) REFERENCES `queue` (`id`)) at /opt/otrs/Kernel/System/DB.pm line 493.
ERROR: OTRS-DBUpdate-to-3.3-10 Perl: 5.26.1 OS: linux Time: Mon Feb 18 15:09:28 2019
Message: Cannot add or update a child row: a foreign key constraint fails (`otrs33`.`#sql-337c_22`, CONSTRAINT `FK_queue_standard_template_queue_id_id` FOREIGN KEY (`queue_id`) REFERENCES `queue` (`id`)), SQL: 'ALTER TABLE queue_standard_template ADD CONSTRAINT FK_queue_standard_template_queue_id_id FOREIGN KEY (queue_id) REFERENCES queue (id)'
Traceback (13267):
Module: main::_AddQueueStandardTemplateForeignKeys (unknown version) Line: 556
ERROR: OTRS-DBUpdate-to-3.3-10 Perl: 5.26.1 OS: linux Time: Mon Feb 18 15:09:28 2019
Message: Error during execution of 'ALTER TABLE queue_standard_template ADD CONSTRAINT FK_queue_standard_template_queue_id_id FOREIGN KEY (queue_id) REFERENCES queue (id)'!
Traceback (13267):
Module: main::_AddQueueStandardTemplateForeignKeys (unknown version) Line: 559
done.
| queue_standard_template | CREATE TABLE `queue_standard_template` (
`queue_id` int(11) NOT NULL,
`standard_template_id` int(11) NOT NULL,
`create_time` datetime NOT NULL,
`create_by` int(11) NOT NULL,
`change_time` datetime NOT NULL,
`change_by` int(11) NOT NULL,
KEY `FK_queue_standard_response_queue_id_id` (`queue_id`),
KEY `FK_queue_standard_response_standard_response_id_id` (`standard_template_id`),
KEY `FK_queue_standard_response_create_by_id` (`create_by`),
KEY `FK_queue_standard_response_change_by_id` (`change_by`),
CONSTRAINT `FK_queue_standard_template_standard_template_id_id` FOREIGN KEY (`standard_template_id`) REFERENCES `standard_template` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
MariaDB [otrs33]> select COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_COLUMN_NAME, REFERENCED_TABLE_NAME
-> from information_schema.KEY_COLUMN_USAGE
-> where TABLE_NAME = 'queue_standard_template';
+----------------------+----------------------------------------------------+------------------------+-----------------------+
| COLUMN_NAME | CONSTRAINT_NAME | REFERENCED_COLUMN_NAME | REFERENCED_TABLE_NAME |
+----------------------+----------------------------------------------------+------------------------+-----------------------+
| standard_template_id | FK_queue_standard_template_standard_template_id_id | id | standard_template |
+----------------------+----------------------------------------------------+------------------------+-----------------------+
1 row in set (0.00 sec)If I'm reading the results correctly I'm missing one constraint on the queue_id table. The first constraint , FK_queue_standard_template_standard_template_id_id appeared to apply correctly.
But the second constraint here did not apply:
ALTER TABLE queue_standard_template ADD CONSTRAINT FK_queue_standard_template_queue_id_id FOREIGN KEY (queue_id) REFERENCES queue (id)If correctly applied the results should read:
----------------------+----------------------------------------------------+------------------------+-----------------------+
| COLUMN_NAME | CONSTRAINT_NAME | REFERENCED_COLUMN_NAME | REFERENCED_TABLE_NAME |
+----------------------+----------------------------------------------------+------------------------+-----------------------+
| standard_template_id | FK_queue_standard_template_standard_template_id_id | id | standard_template |
+----------------------+----------------------------------------------------+------------------------+-----------------------+
| standard_template_id | FK_queue_standard_template_queue_id_id | id | queue |
+----------------------+----------------------------------------------------+------------------------+-----------------------+