diff --git a/scripts/install b/scripts/install index b6432cc..6cb7220 100644 --- a/scripts/install +++ b/scripts/install @@ -81,9 +81,7 @@ ynh_app_setting_set "$app" db_name "$db_name" ynh_app_setting_set "$app" psqlpwd "$db_pwd" # Initialize database and store postgres password for upgrade -ynh_psql_create_db "$db_name" "$db_user" "$db_pwd" - -systemctl reload postgresql +ynh_psql_setup_db --db_name="$db_name" --db_user="$db_user" --db_pwd="$db_pwd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -183,9 +181,9 @@ admin_mail=$(ynh_user_get_info "$admin" "mail") cd "$final_path/code/" # needed for enabling the 'unaccent' extension - ynh_psql_execute_as_root "ALTER USER $db_user WITH SUPERUSER;" + ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name" python api/manage.py migrate - ynh_psql_execute_as_root "ALTER USER $db_user WITH NOSUPERUSER;" + ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name" echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('$admin', '$admin_mail', 'funkwhale') " | python api/manage.py shell python api/manage.py collectstatic ) diff --git a/scripts/remove b/scripts/remove index dd972df..c0ec4f6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -68,7 +68,7 @@ ynh_secure_remove "/etc/systemd/system/$app.target" ynh_print_info "Removing the PostgreSQL database" # Remove a database if it exists, along with the associated user -ynh_psql_remove_db "$db_name" "$app" +ynh_psql_remove_db --db_name="$db_name" --db_user="$app" #================================================= # REMOVE THE REDIS DATABASE diff --git a/scripts/restore b/scripts/restore index 65d88bd..c9742c6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -103,8 +103,8 @@ ynh_install_app_dependencies $pkg_dependencies ynh_print_info "Restoring the PostgreSQL database..." ynh_psql_test_if_first_run -ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd" -ynh_psql_execute_file_as_root ./db.sql "$db_name" +ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd" +ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" #================================================= # RESTORE USER RIGHTS diff --git a/scripts/upgrade b/scripts/upgrade index 719a823..27ec307 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -206,9 +206,9 @@ ynh_replace_string "__FINALPATH__" "$final_path" "$loadfile" cd "$final_path/code" # needed for enabling the 'unaccent' extension - ynh_psql_execute_as_root "ALTER USER $db_user WITH SUPERUSER;" + ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name" python api/manage.py migrate - ynh_psql_execute_as_root "ALTER USER $db_user WITH NOSUPERUSER;" + ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name" python api/manage.py collectstatic --clear --noinput