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 if [ -d /data/mysql ]; then
cp -R /data/mysql /var/lib cp -R /data/mysql /var/lib
echo "Restored database to default state" echo "[INFO] -> Restored database to default state"
else else
# Dump structure # Dump structure
for file in dump/*-*.sql; do echo "[INFO] -> Imported ./dump/truncateAll.sql"
echo "Imported $file" mysql -u root -f < ./dump/truncateAll.sql
mysql -u root -fc < $file echo "[INFO] -> Imported ./dump/structure.sql"
done mysql -u root -f < ./dump/structure.sql
echo "[INFO] -> Imported ./dump/mysqlPlugins.sql"
mysql -u root -f < ./dump/mysqlPlugins.sql
# Import changes # Import changes
for file in changes/*/*.sql; do for file in changes/*/*.sql; do
echo "Imported $file" echo "[INFO] -> Imported ./$file"
mysql -u root -fc < $file mysql -u root -fc < $file
done done
# Import fixtures # Import fixtures
echo "Imported fixtures.sql" echo "[INFO] -> Imported ./dump/dumpedFixtures.sql"
mysql -u root -f < dump/fixtures.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 # Copy dumpted data to volume
cp -R /var/lib/mysql /data cp -R /var/lib/mysql /data
echo "[INFO] -> Dumped database"
fi fi