salix/services/db/install/boot.sh

26 lines
552 B
Bash
Raw Normal View History

2018-04-30 06:46:41 +00:00
#!/bin/bash
if [ -d /data/mysql ]; then
cp -R /data/mysql /var/lib
echo "Restored database to default state"
else
2018-04-30 06:46:41 +00:00
# Dump structure
for file in dump/*-*.sql; do
echo "Imported $file"
mysql -u root -proot < $file
done
2018-04-30 06:46:41 +00:00
# Import changes
for file in changes/*/*.sql; do
echo "Imported $file"
mysql -u root -proot < $file
done
# Import fixtures
echo "Imported fixtures.sql"
2018-05-09 05:20:30 +00:00
mysql -u root -proot -f < dump/fixtures.sql
# Copy dumpted data to volume
cp -R /var/lib/mysql /data
fi