en mode mysql upgrade la database en mode mysql

This commit is contained in:
Emmanuel Garette 2019-02-21 14:10:54 +01:00
parent 8c28ae6e6b
commit 3a74f7932c

View File

@ -33,7 +33,13 @@ function updateDB()
if [[ -f ${dbfile} ]] if [[ -f ${dbfile} ]]
then then
$cmd upgrade -f -s ${dbfile} if [ $(CreoleGet one_database_type) = "mysql" ]; then
if [ $(CreoleGet one_ha_server_index 0) = "0" ]; then
$cmd sqlite2mysql -u $USER -p $PASS -d $DB -S $HOST
fi
else
$cmd upgrade -f -s ${dbfile}
fi
res=${?} res=${?}
clean_backups ${dbfile} clean_backups ${dbfile}
return ${res} return ${res}
@ -52,20 +58,20 @@ function to_mysql() {
DB=$(CreoleGet one_database_name) DB=$(CreoleGet one_database_name)
USER=$(CreoleGet one_database_user) USER=$(CreoleGet one_database_user)
PASS=$(CreoleGet one_database_pass) PASS=$(CreoleGet one_database_pass)
cp -a /etc/one/oned.conf /etc/one/oned.conf.ori cp -a /etc/one/oned.conf /etc/one/oned.conf.ori
# HA ne doit pas être activer pour la migration # HA ne doit pas être activer pour la migration
CreoleCat -s /usr/share/eole/creole/distrib/oned-ha-mysql.conf -o /etc/one/oned.conf CreoleCat -s /usr/share/eole/creole/distrib/oned-ha-mysql.conf -o /etc/one/oned.conf
oned -i oned -i
onedb sqlite2mysql -s /var/lib/one/one.db -u $USER -p $PASS -d $DB -S $HOST onedb sqlite2mysql -s /var/lib/one/one.db -u $USER -p $PASS -d $DB -S $HOST
cp -a /etc/one/oned.conf.ori /etc/one/oned.conf cp -a /etc/one/oned.conf.ori /etc/one/oned.conf
fi fi
fi fi
} }
echo
to_mysql
echo echo
EchoGras "Mise à jour de la base de données ONE" EchoGras "Mise à jour de la base de données ONE"
echo echo
updateDB updateDB
echo
to_mysql
exit ${?} exit ${?}