mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
Fix
This commit is contained in:
parent
05b817c6b6
commit
d4cc76f91c
2 changed files with 62 additions and 22 deletions
|
@ -11,6 +11,44 @@ pkg_dependencies="postgresql postgresql-contrib pgloader"
|
|||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
mysql-to-pg() {
|
||||
|
||||
if mysqlshow | grep -q "^| $db_name "; then
|
||||
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=10
|
||||
|
||||
mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
|
||||
db_pwd=$(ynh_string_random --length=24)
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
|
||||
tmpdir="$(mktemp -d)"
|
||||
ynh_add_config --template="../conf/mysql-to-pg.conf" --destination="$tmpdir/mysql-to-pg.conf"
|
||||
# Migrating from MySQL to PostgreSQL
|
||||
pgloader $tmpdir/mysql-to-pg.conf
|
||||
|
||||
# Removinging MySQL database
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
ynh_secure_remove --file="$tmpdir"
|
||||
|
||||
smtp_user_pwd=$(ynh_string_random --length=24)
|
||||
url=https://$domain$path_url
|
||||
ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
|
||||
|
||||
chmod 400 "$final_path/config/config.json"
|
||||
chown $app:$app "$final_path/config/config.json"
|
||||
|
||||
else
|
||||
ynh_print_info --message="No migration needed"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -179,36 +179,38 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|||
# MIGRATING DATABASE
|
||||
#=================================================
|
||||
|
||||
if mysqlshow | grep -q "^| $db_name "; then
|
||||
mysql-to-pg
|
||||
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=10
|
||||
# if mysqlshow | grep -q "^| $db_name "; then
|
||||
|
||||
mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
# ynh_script_progression --message="Creating a PostgreSQL database..." --weight=10
|
||||
|
||||
db_pwd=$(ynh_string_random --length=24)
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
# mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
|
||||
tmpdir="$(mktemp -d)"
|
||||
ynh_add_config --template="../conf/mysql-to-pg.conf" --destination="$tmpdir/mysql-to-pg.conf"
|
||||
# Migrating from MySQL to PostgreSQL
|
||||
pgloader $tmpdir/mysql-to-pg.conf
|
||||
# db_pwd=$(ynh_string_random --length=24)
|
||||
# ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
# ynh_psql_test_if_first_run
|
||||
# ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
|
||||
# Removinging MySQL database
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
ynh_secure_remove --file="$tmpdir"
|
||||
# tmpdir="$(mktemp -d)"
|
||||
# ynh_add_config --template="../conf/mysql-to-pg.conf" --destination="$tmpdir/mysql-to-pg.conf"
|
||||
# # Migrating from MySQL to PostgreSQL
|
||||
# pgloader $tmpdir/mysql-to-pg.conf
|
||||
|
||||
smtp_user_pwd=$(ynh_string_random --length=24)
|
||||
url=https://$domain$path_url
|
||||
ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
|
||||
# # Removinging MySQL database
|
||||
# ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
# ynh_secure_remove --file="$tmpdir"
|
||||
|
||||
chmod 400 "$final_path/config/config.json"
|
||||
chown $app:$app "$final_path/config/config.json"
|
||||
# smtp_user_pwd=$(ynh_string_random --length=24)
|
||||
# url=https://$domain$path_url
|
||||
# ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
|
||||
|
||||
else
|
||||
ynh_print_info --message="No migration needed"
|
||||
fi
|
||||
# chmod 400 "$final_path/config/config.json"
|
||||
# chown $app:$app "$final_path/config/config.json"
|
||||
|
||||
# else
|
||||
# ynh_print_info --message="No migration needed"
|
||||
# fi
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
|
|
Loading…
Add table
Reference in a new issue