Hi,
I do know that mysql is not supported but sadly our IT DB service doesnt offer mariadb.
As postgresql is offered by our central IT I wonder if you have a migration path/script(s) to do so?
My second question is related to the upgrade script when moving from 12 to 13 (I am moving from 12.12 to 13.0): _/usr/share/opencast/docs/upgrade/12_to_13/mariadb.sql_
The script doesnt run on mysql natively as it using specific mariadb syntax. I have tried to translated into Mysql jargon [1]. I am kind of confused about this type of statements:
ALTER TABLE oc_workflow_operation
DROP FOREIGN KEY IF EXISTS FK_oc_workflow_operation_workflow_id,
ADD FOREIGN KEY IF NOT EXISTS IX_oc_workflow_operation_workflow_id (`workflow_id`) REFERENCES `oc_workflow` (`id`);
If you dont set a name for the Foreign Key it will be random one (kind of), is not more advice able to name it, for future upgrades? I take for granted that the IX_oc_workflow_operation_workflow_id doesnt exist in fact, which it's my case.
Thank you,
Ruben
[1]
/* CREATE INDEX IF NOT EXISTS IX_oc_aws_asset_mapping_object_key ON oc_aws_asset_mapping (object_key);
*/
set @var=if((SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE
TABLE_SCHEMA = database() AND
TABLE_NAME = 'oc_aws_asset_mapping' AND
INDEX_NAME='IX_oc_aws_asset_mapping_object_key') = 0,
'ALTER TABLE oc_aws_asset_mapping ADD Index IX_oc_aws_asset_mapping_object_key (object_key)',
'select "Nothing to be done"');
prepare stmt from @var;
execute stmt;
deallocate prepare stmt;
/* CREATE INDEX IF NOT EXISTS IX_oc_job_argument_id ON oc_job_argument (id);
*/
set @var=if((SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE
TABLE_SCHEMA = database() AND
TABLE_NAME = 'oc_job_argument' AND
INDEX_NAME='IX_oc_job_argument_id') = 0,
'ALTER TABLE oc_job_argument ADD Index IX_oc_job_argument_id (id)',
'select "Nothing to be done"');
prepare stmt from @var;
execute stmt;
deallocate prepare stmt;
ALTER TABLE oc_workflow
MODIFY COLUMN `description` LONGTEXT DEFAULT NULL;
ALTER TABLE oc_workflow_operation
MODIFY COLUMN `description` LONGTEXT DEFAULT NULL,
MODIFY COLUMN `if_condition` LONGTEXT DEFAULT NULL;
DROP PROCEDURE IF EXISTS PROC_DROP_FOREIGN_KEY;
DELIMITER $$
CREATE PROCEDURE PROC_DROP_FOREIGN_KEY(IN tableName VARCHAR(128), IN constraintName VARCHAR(128))
BEGIN
IF EXISTS(
SELECT * FROM information_schema.table_constraints
WHERE
table_schema = DATABASE() AND
table_name = tableName AND
constraint_name = constraintName AND
constraint_type = 'FOREIGN KEY')
THEN
SET @query = CONCAT('ALTER TABLE ', tableName, ' DROP FOREIGN KEY ', constraintName, ';');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
END$$
DELIMITER ;
/* ALTER TABLE oc_workflow_configuration
DROP FOREIGN KEY IF EXISTS FK_oc_workflow_configuration_workflow_id,
ADD FOREIGN KEY IF NOT EXISTS IX_oc_workflow_configuration_workflow_id (`workflow_id`) REFERENCES `oc_workflow` (`id`);
*/
call PROC_DROP_FOREIGN_KEY('oc_workflow_configuration', 'FK_oc_workflow_configuration_workflow_id');
set @var=if((SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE
TABLE_SCHEMA = database() AND
TABLE_NAME = 'oc_workflow_configuration' AND
INDEX_NAME='IX_oc_workflow_configuration_workflow_id') = 0,
'ALTER TABLE oc_workflow_configuration ADD CONSTRAINT FK_oc_workflow_configuration_workflow_id FOREIGN KEY (`workflow_id`) REFERENCES `oc_workflow` (`id`)',
'select "Nothing to be done"');
prepare stmt from @var;
execute stmt;
deallocate prepare stmt;
/* ALTER TABLE oc_workflow_operation
DROP FOREIGN KEY IF EXISTS FK_oc_workflow_operation_workflow_id,
ADD FOREIGN KEY IF NOT EXISTS IX_oc_workflow_operation_workflow_id (`workflow_id`) REFERENCES `oc_workflow` (`id`);
*/
call PROC_DROP_FOREIGN_KEY('oc_workflow_operation', 'FK_oc_workflow_operation_workflow_id');
set @var=if((SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE
TABLE_SCHEMA = database() AND
TABLE_NAME = 'oc_workflow_operation' AND
INDEX_NAME='IX_oc_workflow_operation_workflow_id') = 0,
'ALTER TABLE oc_workflow_operation ADD CONSTRAINT FK_oc_workflow_operation_workflow_id FOREIGN KEY (`workflow_id`) REFERENCES `oc_workflow` (`id`)',
'select "Nothing to be done"');
prepare stmt from @var;
execute stmt;
deallocate prepare stmt;
/*
ALTER TABLE oc_workflow_operation_configuration
DROP FOREIGN KEY IF EXISTS cworkflowoperationconfigurationworkflowoperationid,
ADD FOREIGN KEY IF NOT EXISTS IX_oc_workflow_operation_configuration_workflow_operation_id (`workflow_operation_id`) REFERENCES `oc_workflow_operation` (`id`);
*/
call PROC_DROP_FOREIGN_KEY('oc_workflow_operation_configuration', 'cworkflowoperationconfigurationworkflowoperationid');
set @var=if((SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE
TABLE_SCHEMA = database() AND
TABLE_NAME = 'oc_workflow_operation_configuration' AND
INDEX_NAME='IX_oc_workflow_operation_configuration_workflow_operation_id') = 0,
'ALTER TABLE oc_workflow_operation_configuration ADD CONSTRAINT cworkflowoperationconfigurationworkflowoperationid FOREIGN KEY (`workflow_operation_id`) REFERENCES `oc_workflow_operation` (`id`)',
'select "Nothing to be done"');
prepare stmt from @var;
execute stmt;
deallocate prepare stmt;
UPDATE oc_workflow_configuration
SET configuration_value = ''
WHERE configuration_value IS NULL;
UPDATE oc_workflow_operation_configuration
SET configuration_value = ''
WHERE configuration_value IS NULL;