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
1 changed files with 14 additions and 8 deletions

View File

@ -33,7 +33,13 @@ function updateDB()
if [[ -f ${dbfile} ]]
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=${?}
clean_backups ${dbfile}
return ${res}
@ -52,20 +58,20 @@ function to_mysql() {
DB=$(CreoleGet one_database_name)
USER=$(CreoleGet one_database_user)
PASS=$(CreoleGet one_database_pass)
cp -a /etc/one/oned.conf /etc/one/oned.conf.ori
# 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
oned -i
cp -a /etc/one/oned.conf /etc/one/oned.conf.ori
# 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
oned -i
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
}
echo
to_mysql
echo
EchoGras "Mise à jour de la base de données ONE"
echo
updateDB
echo
to_mysql
exit ${?}