1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

Update upgrade

This commit is contained in:
Éric Gaspar 2024-06-25 15:47:53 +02:00
parent 2d4ff6bfbf
commit 1583a7c9c4

View file

@ -75,26 +75,26 @@ exec_occ() {
# HANDLE DATABASE MIGRATION FROM MYSL TO PSQL # HANDLE DATABASE MIGRATION FROM MYSL TO PSQL
#================================================= #=================================================
# If we're moving through version 29.0.2~ynh1 (in which the switch to psql is made) # # If we're moving through version 29.0.3~ynh1 (in which the switch to psql is made)
if ynh_compare_current_package_version --comparison lt --version 29.0.3~ynh1 # if ynh_compare_current_package_version --comparison lt --version 29.0.3~ynh1
then # then
# Double-check the MySQL DB is here # # Double-check the MySQL DB is here
if ! mysql -e "USE $db_name" 2>/dev/null # if ! mysql -e "USE $db_name" 2>/dev/null
then # then
ynh_print_warn "Uhoh? The Nextcloud MySQL DB doesn't exist? We are supposed to move it to PostgreSQL... Maybe it was already migrated?" # ynh_print_warn "Uhoh? The Nextcloud MySQL DB doesn't exist? We are supposed to move it to PostgreSQL... Maybe it was already migrated?"
# Double check the psql is not empty, otherwise big whoops? # # Double check the psql is not empty, otherwise big whoops?
if [[ "$(ynh_psql_execute_as_root --database=$db_name --sql="\dt" 2>/dev/null | wc -l)" == 0 ]] # if [[ "$(ynh_psql_execute_as_root --database=$db_name --sql="\dt" 2>/dev/null | wc -l)" == 0 ]]
then # then
ynh_die "Apparently the PostgreSQL DB is also empty, this is kind of worrying, what happened?!" # ynh_die "Apparently the PostgreSQL DB is also empty, this is kind of worrying, what happened?!"
else # else
ynh_print_warn "Apparently the PostgreSQL DB is not empty, so this is probably OK?" # ynh_print_warn "Apparently the PostgreSQL DB is not empty, so this is probably OK?"
fi # fi
else # else
ynh_print_info --message="Migrating to PostgreSQL database..." # ynh_print_info --message="Migrating to PostgreSQL database..."
ynh_exec_warn_less exec_occ db:convert-type --all-apps --clear-schema pgsql $db_name 127.0.0.1 $db_name --password=$db_pwd -n # ynh_exec_warn_less exec_occ db:convert-type --all-apps --clear-schema pgsql $db_name 127.0.0.1 $db_name --password=$db_pwd -n
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name # ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
fi # fi
fi # fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE