1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00
This commit is contained in:
Éric Gaspar 2022-06-28 23:08:13 +02:00
parent c0be550b10
commit 05b817c6b6
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 9 additions and 7 deletions

View file

@ -1,5 +1,5 @@
LOAD DATABASE LOAD DATABASE
FROM mysql://mattermost:$mysql_db_pwd@localhost:3306/mattermost FROM mysql://mattermost:__MYSQL_DB_PWD__@localhost:3306/mattermost
INTO postgresql://mattermost:$postgres_db_pwd@localhost:5432/mattermost INTO postgresql://mattermost:__DB_PWD__@localhost:5432/mattermost
WITH data only WITH data only
; ;

View file

@ -185,20 +185,22 @@ if mysqlshow | grep -q "^| $db_name "; then
mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
postgres_db_pwd=$(ynh_string_random --length=24) db_pwd=$(ynh_string_random --length=24)
ynh_app_setting_set --app=$app --key=postgres_db_pwd --value=$postgres_db_pwd ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$postgres_db_pwd 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 # Migrating from MySQL to PostgreSQL
pgloader ../conf/mysql-to-pg.conf pgloader $tmpdir/mysql-to-pg.conf
# Removinging MySQL database # Removinging MySQL database
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name 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) smtp_user_pwd=$(ynh_string_random --length=24)
url=https://$domain$path_url url=https://$domain$path_url
$postgres_db_pwd=$db_pwd
ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json" ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
chmod 400 "$final_path/config/config.json" chmod 400 "$final_path/config/config.json"