aboutsummaryrefslogtreecommitdiff
path: root/scripts/restore
diff options
context:
space:
mode:
authoryalh76 <yalh@yahoo.com>2019-05-10 19:38:49 +0200
committeryalh76 <yalh@yahoo.com>2019-05-10 19:38:49 +0200
commit55a0d422f7aebbc4907e0726f3336883f0820357 (patch)
tree4af477efa00bbb50446f5b57dac6cca077281061 /scripts/restore
parentae5845526a964e0ab8161acf74b060f733191c5e (diff)
downloadmastodon_ynh-55a0d422f7aebbc4907e0726f3336883f0820357.tar.gz
mastodon_ynh-55a0d422f7aebbc4907e0726f3336883f0820357.tar.bz2
mastodon_ynh-55a0d422f7aebbc4907e0726f3336883f0820357.zip
switch to ynh_psql_setup_db
Diffstat (limited to 'scripts/restore')
-rw-r--r--scripts/restore6
1 files changed, 2 insertions, 4 deletions
diff --git a/scripts/restore b/scripts/restore
index 0b5bde2..1255b7b 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -34,6 +34,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$app
+db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@@ -115,11 +116,8 @@ ynh_install_ruby --ruby_version=2.6.0
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --time --weight=1
-db_pwd=$(ynh_app_setting_get "$app" db_pwd)
-
ynh_psql_test_if_first_run
-ynh_psql_create_user "$db_user" "$db_pwd"
-ynh_psql_execute_as_root --sql="CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $db_user;"
+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"
#=================================================