mirror of
https://github.com/YunoHost-Apps/lufi_ynh.git
synced 2024-09-03 19:36:28 +02:00
Fix the upgrade from an old commit
This commit is contained in:
parent
a78b89f604
commit
3bcb0958cb
1 changed files with 17 additions and 9 deletions
|
@ -45,15 +45,7 @@ then # Si final_path n'est pas renseigné dans la config yunohost, cas d'ancien
|
|||
fi
|
||||
|
||||
if [ -z "$db_pwd" ]; then
|
||||
# Create postgresql database
|
||||
ynh_psql_test_if_first_run
|
||||
db_name=$(ynh_sanitize_dbid "$app")
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set "$app" db_name "$db_name"
|
||||
# Initialize database and store postgres password for upgrade
|
||||
ynh_psql_setup_db "$db_name" "$db_user"
|
||||
db_pwd=$(ynh_app_setting_get $app psqlpwd) # Password created in ynh_psql_setup_db function
|
||||
|
||||
# Need to install new dependencies before creating the new database
|
||||
need_migration_from_sqlite_to_psql=1
|
||||
else
|
||||
need_migration_from_sqlite_to_psql=0
|
||||
|
@ -89,6 +81,22 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE IF NEEDED
|
||||
#=================================================
|
||||
|
||||
if [ $need_migration_from_sqlite_to_psql -eq 1 ]; then
|
||||
ynh_print_info "Creating a PostgreSQL database..."
|
||||
# Create postgresql database
|
||||
ynh_psql_test_if_first_run
|
||||
db_name=$(ynh_sanitize_dbid "$app")
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set "$app" db_name "$db_name"
|
||||
# Initialize database and store postgres password for upgrade
|
||||
ynh_psql_setup_db "$db_name" "$db_user"
|
||||
db_pwd=$(ynh_app_setting_get $app psqlpwd) # Password created in ynh_psql_setup_db function
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue