1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wallabag2_ynh.git synced 2024-10-01 13:35:06 +02:00
This commit is contained in:
Nicolas Frandeboeuf 2023-11-16 14:38:50 +01:00 committed by GitHub
commit 5c63a5c4c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,43 @@
# Drop old foreign keys
ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY IF EXISTS FK_D247A21BA76ED395;
ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY IF EXISTS FK_D247A21B19EB6921;
ALTER TABLE `oauth2_auth_codes` DROP FOREIGN KEY IF EXISTS FK_A018A10DA76ED395;
ALTER TABLE `oauth2_clients` DROP FOREIGN KEY IF EXISTS FK_F9D02AE6A76ED395;
ALTER TABLE `oauth2_refresh_tokens` DROP FOREIGN KEY IF EXISTS FK_D394478CA76ED395;
ALTER TABLE `config` DROP FOREIGN KEY IF EXISTS FK_D48A2F7CA76ED395;
ALTER TABLE `entry` DROP FOREIGN KEY IF EXISTS FK_2B219D70A76ED395;
ALTER TABLE `oauth2_auth_codes` DROP FOREIGN KEY IF EXISTS FK_A018A10D19EB6921;
ALTER TABLE `oauth2_refresh_tokens` DROP FOREIGN KEY IF EXISTS FK_D394478C19EB6921;
ALTER TABLE `tagging_rule` DROP FOREIGN KEY IF EXISTS FK_1AF95E7824DB0683;
# Add new expected ones, dropping them before creation to avoid errors.
ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY IF EXISTS FK_368A4209A76ED395;
ALTER TABLE `oauth2_access_tokens` ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY IF EXISTS FK_368A420919EB6921;
ALTER TABLE `oauth2_access_tokens` ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (`client_id`) REFERENCES `oauth2_clients` (`id`);
ALTER TABLE `oauth2_auth_codes` DROP FOREIGN KEY IF EXISTS FK_EE52E3FAA76ED395;
ALTER TABLE `oauth2_auth_codes` ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `oauth2_clients` DROP FOREIGN KEY IF EXISTS FK_635D765EA76ED395;
ALTER TABLE `oauth2_clients` ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `oauth2_refresh_tokens` DROP FOREIGN KEY IF EXISTS FK_20C9FB24A76ED395;
ALTER TABLE `oauth2_refresh_tokens` ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `config` DROP FOREIGN KEY IF EXISTS FK_87E64C53A76ED395;
ALTER TABLE `config` ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `entry` DROP FOREIGN KEY IF EXISTS FK_F4D18282A76ED395;
ALTER TABLE `entry` ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `oauth2_auth_codes` DROP FOREIGN KEY IF EXISTS FK_EE52E3FA19EB6921;
ALTER TABLE `oauth2_auth_codes` ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (`client_id`) REFERENCES `oauth2_clients` (`id`);
ALTER TABLE `oauth2_refresh_tokens` DROP FOREIGN KEY IF EXISTS FK_20C9FB2419EB6921;
ALTER TABLE `oauth2_refresh_tokens` ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (`client_id`) REFERENCES `oauth2_clients` (`id`);
ALTER TABLE `tagging_rule` DROP FOREIGN KEY IF EXISTS FK_2D9B3C5424DB0683;
ALTER TABLE `tagging_rule` ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (`config_id`) REFERENCES `config` (`id`);

View file

@ -159,6 +159,11 @@ then
ynh_replace_string --match_string="secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv" --replace_string="secret: $deskey" --target_file=$wb_conf
ynh_replace_string --match_string="domain_name: https://your-wallabag-url-instance.com" --replace_string="domain_name: https://$domain$path_url" --target_file=$wb_conf
# Migrate old (erroneous) database scheme (see: https://github.com/YunoHost-Apps/wallabag2_ynh/pull/125#issuecomment-1041426972)
ynh_script_progression --message="Migrating old (pre-2018) database scheme..." --weight=11
ynh_exec_warn_less ynh_mysql_execute_file_as_root --file="../migrations/foreign-keys-renaming.sql" --database=$db_name
ynh_script_progression --message="Database migration done. Resuming normal upgrade process" --weight=11
#=================================================
# UPGRADE WALLABAG
#=================================================