1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00

delete the psql db if the migration fails

This commit is contained in:
Kay0u 2023-03-07 09:52:10 +01:00
parent 386cdb633d
commit b4fcf41f41
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D

View file

@ -56,6 +56,10 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the PostgreSQL db in case of error during the migration.
if [ -n "$remove_psql_in_case_of_error" ]; then
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
fi
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -118,6 +122,7 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
if mysqlshow | grep -q "^| $db_name "; then
# Mattermost only support MySQL and PostgreSQL (not MariaDB...)
# Migrate the database from MariaDB to PostgreSQL
remove_psql_in_case_of_error=1
mariadb-to-pg
fi