mirror of
https://github.com/YunoHost-Apps/mastodon_ynh.git
synced 2024-09-03 19:46:02 +02:00
switch to ynh_psql_setup_db
This commit is contained in:
parent
ae5845526a
commit
55a0d422f7
2 changed files with 3 additions and 6 deletions
|
@ -119,8 +119,7 @@ db_pwd=$(ynh_string_random 30)
|
|||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$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
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
|
|
@ -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"
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue