mirror of
https://github.com/YunoHost-Apps/codimd_ynh.git
synced 2024-09-03 18:16:32 +02:00
move to postgres
This commit is contained in:
parent
e274a9e31b
commit
3bb697888b
8 changed files with 19 additions and 17 deletions
|
@ -4,5 +4,5 @@ module.exports = {
|
|||
'config': path.resolve('config.json'),
|
||||
'migrations-path': path.resolve('lib', 'migrations'),
|
||||
'models-path': path.resolve('lib', 'models'),
|
||||
'url': 'mysql://__DB_USER__:__DB_PASS__@localhost:3306/__DB_NAME__'
|
||||
'url': 'postgres://__DB_USER__:__DB_PASS__@localhost:5432/__DB_NAME__'
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
"password": "__DB_PASS__",
|
||||
"database": "__DB_NAME__",
|
||||
"host": "localhost",
|
||||
"port": "3306",
|
||||
"dialect": "mysql"
|
||||
"port": "5432",
|
||||
"dialect": "postgres"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="apt-transport-https"
|
||||
pkg_dependencies="postgresql apt-transport-https"
|
||||
|
||||
nodejs_version="10"
|
||||
|
||||
|
|
|
@ -50,11 +50,11 @@ ynh_backup --src_path="$final_path"
|
|||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
# BACKUP THE DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the database..."
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
|
|
|
@ -80,8 +80,10 @@ ynh_script_progression --message="Creating a database..." --weight=2
|
|||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_app_setting_set --app="$app" --key="db_name" --value="$db_name"
|
||||
ynh_mysql_setup_db --db_user="$db_user" --db_name="$db_name"
|
||||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
|
|
@ -34,12 +34,12 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
# REMOVE THE DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..." --weight=2
|
||||
ynh_script_progression --message="Removing the database..." --weight=2
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
|
|
|
@ -89,13 +89,13 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
|
|||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
# RESTORE THE DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=6
|
||||
ynh_script_progression --message="Restoring the database..." --weight=6
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
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
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
|
|
|
@ -24,7 +24,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=app)
|
||||
db_user=$(ynh_app_setting_get --app=$app --key=app)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlwd)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
|
Loading…
Reference in a new issue