mirror of
https://github.com/YunoHost-Apps/galette_ynh.git
synced 2024-09-03 18:36:28 +02:00
database type management
added database management in restore and remove
This commit is contained in:
parent
1c1f6e7b9b
commit
7cd0c5df32
2 changed files with 27 additions and 6 deletions
|
@ -9,6 +9,20 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
#Remove the data base
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the database..." --weight=2
|
||||
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
|
||||
if [ $db_type == "mysql" ]; then
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
elif [ $db_type == "postgresql" ]; then
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
|
|
|
@ -27,14 +27,21 @@ chmod -R o-rwx "$install_dir"
|
|||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
# RESTORE THE DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||
ynh_script_progression --message="Restoring the database..." --weight=1
|
||||
|
||||
if [ $db_type == "mysql" ]; then
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
elif [ $db_type == "postgresql" ]; then
|
||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
if [ $db_type == "mysql" ]; then
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
elif [ $db_type == "postgresql" ]; then
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue