Hydra upgrade blocked by missing mariadb feature
Even after fixing #1472 (closed) by upgrading to mariadb 10.10, the hydra upgrade to 0.26
(by now, 0.26.3
) still fails because of another fragment of the hydra database migration that's incompatible with mariadb:
Could not apply migrations:
Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json) WHERE redirect_uris <> '';
UPDATE hydra_client SET grant_types_json = ...' at line 4
error executing migrations/20220513000001000001_string_slice_json.mysql.up.sql, sql: -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
this error should never be printed
UPDATE hydra_client SET redirect_uris_json = cast(concat('["' , REPLACE(redirect_uris,'|','","') , '"]') as json) WHERE redirect_uris <> '';
UPDATE hydra_client SET grant_types_json = cast(concat('["' , REPLACE(grant_types,'|','","') , '"]') as json) WHERE grant_types <> '';
UPDATE hydra_client SET response_types_json = cast(concat('["' , REPLACE(response_types,'|','","') , '"]') as json) WHERE response_types <> '';
UPDATE hydra_client SET audience_json = cast(concat('["' , REPLACE(audience,'|','","') , '"]') as json) WHERE audience <> '';
UPDATE hydra_client SET allowed_cors_origins_json = cast(concat('["' , REPLACE(allowed_cors_origins,'|','","') , '"]') as json) WHERE allowed_cors_origins <> '';
UPDATE hydra_client SET contacts_json = cast(concat('["' , REPLACE(contacts,'|','","') , '"]') as json) WHERE contacts <> '';
UPDATE hydra_client SET request_uris_json = cast(concat('["' , REPLACE(request_uris,'|','","') , '"]') as json) WHERE request_uris <> '';
UPDATE hydra_client SET post_logout_redirect_uris_json = cast(concat('["' , REPLACE(post_logout_redirect_uris,'|','","') , '"]') as json) WHERE post_logout_redirect_uris <> '';
The CAST ... AS JSON
is not supported by mariadb, even though it has a json
type (actually alias for string type) since some time now.
Options:
- persuade mariadb to add this feature (it's actually a null operation so not much work for them I'd expect, still could take any amount of time);
- persuade hydra to rewrite their migration to support current mariadb -- not sure if it's even possible for them to change existing migrations though;
- switch to a different database for single-sign-on -- again.
None of these is very appealing to me, but I'll try 1. first.