mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Migrate from mysql to psql db
This commit is contained in:
parent
f4e4d4ed40
commit
86ad9bac8a
4 changed files with 21 additions and 4 deletions
|
@ -19,8 +19,7 @@
|
|||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.0-fpm",
|
||||
"mysql"
|
||||
"php7.3-fpm"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
pkg_dependencies="imagemagick acl tar smbclient at postgresql"
|
||||
|
||||
YNH_PHP_VERSION="7.3"
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-smbclient php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-pgsql"
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-smbclient php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-pgsql"
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
|
|
|
@ -65,7 +65,7 @@ ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
|||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_create_db --db_user=$db_name --db_name=$db_name
|
||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
|
|
@ -230,6 +230,24 @@ datadir="/home/yunohost.app/$app/data"
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
#=================================================
|
||||
# HANDLE DATABASE MIGRATION
|
||||
#=================================================
|
||||
|
||||
mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
if [ -n "$mysql_db_pwd" ]
|
||||
then
|
||||
ynh_script_progression --message="Migrate Database..."
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
|
||||
|
||||
exec_occ db:convert-type --all-apps pgsql $db_name 127.0.0.1 $db_name --password=$db_pwd -n
|
||||
|
||||
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
|
||||
ynh_app_setting_delete --app=$app --key=mysqlpwd
|
||||
fi
|
||||
|
||||
ynh_script_progression --message="Upgrading Nextcloud..." --weight=3
|
||||
|
||||
# Load the last available version
|
||||
|
|
Loading…
Add table
Reference in a new issue