* Removed unused get note diff function. It doesn't work because everything is encrypted now

* Added a script to sync down the prod database and files to dev
This commit is contained in:
Max G committed 2020-10-10 21:27:52 +00:00
1 parent 941d21d9cb
commit c7e342be4d
6 files changed
+62 -85

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
echo '-------'
echo 'Starting Database Restore'
echo '-------'
#get Latest database backup
# Unzip File
# gzip -dk file.gz
BACKUPDIR="/home/mab/databaseBackupSolidScribe"
DEVDBPASS="Crama!Lama*Jamma###88383!!!!!345345956245i"
cd $BACKUPDIR
# -t sort by modification time, newest first
# -A --almost-all, do not list implied . and ..
LASTZIPPEDFILE=$(ls -At *.gz | head -n1)
# -k keep file after unzip
# -d Decompress
# -v verbose
echo "Unzipping $LASTZIPPEDFILE"
gunzip -dkv $LASTZIPPEDFILE
BACKUPFILE=$(ls -At *.sql | head -n1)
#Fix to replace incompatible DB type
echo "Updating table name in $BACKUPFILE"
sed -i $BACKUPFILE -e 's/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g'
echo "Removing and syncing static files"
rm -r /home/mab/ss/staticFiles/*
rsync -e 'ssh -p 13328' -hazC --update [email protected]:/home/mab/pi/staticFiles /home/mab/ss/
echo "Updating Database"
mysql -u root --password="$DEVDBPASS" < $BACKUPFILE
rm *.sql
echo '-------'
echo "Applied Prod database to Dev. LastFile: $BACKUPFILE"
echo '-------'