#!/bin/bash # mLohn update script 3 -> 4 # Table mitarbeiter: name -> nachname # check parameter usage="upgrade" # check version if mysql -umlohn -pmlohn -N mlohn <<<"select * from version" >/dev/null 2>&1 then echo "version info available." else echo "no version info available." exit 1 fi version=$(mysql -umlohn -pmlohn -N mlohn <<<"select * from version") echo "mLohn version $version found." if [ $version -lt 3 ] then echo "Main version ${version%%.*} found. Upgrade not supported." exit 1 fi if [ $version -eq 4 ] then echo "Main version ${version%%.*} found. No upgrade necessary." exit 0 fi echo "Dump database" mysqldump --default-character-set=utf8 mlohn -umlohn -pmlohn >mlohn.dump || exit 1 echo "Rename tables in current database" mysql -umlohn -pmlohn mlohn <