updated docker dump order #714

This commit is contained in:
Joan Sanchez 2018-10-08 13:37:57 +02:00
parent f878751ff1
commit 33c4ed73ca
5 changed files with 14 additions and 8 deletions

View File

@ -3,24 +3,30 @@ export MYSQL_PWD=root
if [ -d /data/mysql ]; then
cp -R /data/mysql /var/lib
echo "Restored database to default state"
echo "[INFO] -> Restored database to default state"
else
# Dump structure
for file in dump/*-*.sql; do
echo "Imported $file"
mysql -u root -fc < $file
done
echo "[INFO] -> Imported ./dump/truncateAll.sql"
mysql -u root -f < ./dump/truncateAll.sql
echo "[INFO] -> Imported ./dump/structure.sql"
mysql -u root -f < ./dump/structure.sql
echo "[INFO] -> Imported ./dump/mysqlPlugins.sql"
mysql -u root -f < ./dump/mysqlPlugins.sql
# Import changes
for file in changes/*/*.sql; do
echo "Imported $file"
echo "[INFO] -> Imported ./$file"
mysql -u root -fc < $file
done
# Import fixtures
echo "Imported fixtures.sql"
mysql -u root -f < dump/fixtures.sql
echo "[INFO] -> Imported ./dump/dumpedFixtures.sql"
mysql -u root -f < ./dump/dumpedFixtures.sql
echo "[INFO] -> Imported ./dump/fixtures.sql"
mysql -u root -f < ./dump/fixtures.sql
# Copy dumpted data to volume
cp -R /var/lib/mysql /data
echo "[INFO] -> Dumped database"
fi