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

Make sure that the db_name is set on upgrade

This commit is contained in:
nicofrand 2020-12-17 20:25:46 +01:00 committed by Nicolas Frandeboeuf
parent 607a04d891
commit 55968fce5f

View file

@ -36,6 +36,15 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
# Previous versions did not set the DB name as a setting, so we need to set it now (will be used on
# remove).
if [ -z "$db_name" ]
then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
db_user=$db_name
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]
then
@ -83,10 +92,6 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
if [ -z "$db_pwd" ]
then
ynh_script_progression --message="Setting up database"
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)