Last active
April 14, 2021 00:12
Revisions
-
mithereal revised this gist
Nov 17, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ else echo "schema committed" fi else mysqldump -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME --skip-dump-date --single-transaction --no-data > $NEW git add $NEW echo "schema committed" fi -
mithereal revised this gist
Nov 17, 2015 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,22 +11,22 @@ OLD=$NEW.old DIR=$(pwd) cd $GITREPO if [ -f "$NEW" ] then mv $NEW $OLD mysqldump -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME --skip-dump-date --single-transaction --no-data > $NEW if cmp -s $OLD $NEW; then echo Databases are the Same else echo changes detected in database schema git add $NEW echo "schema committed" fi else mysqldump -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME > $NEW git add $NEW echo "schema committed" fi cd $DIR -
wilcollins revised this gist
Jun 22, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,12 +16,13 @@ mv $NEW $OLD mysqldump -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME --skip-dump-date --single-transaction > $NEW # NOTE : ignore .old if cmp -s $OLD $NEW; then echo Same else echo Differ git add $NEW git commit $NEW -m "$DBNAME DB update" echo "schema+data committed" -
wilcollins created this gist
Jun 22, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/bin/bash -e # -e means exit if any command fails DBHOST=address.to.your.server DBUSER=username DBPASS=password # do this in a more secure fashion DBNAME=DBNAME GITREPO=/where/is/your/repo DUMP=$GITREPO/where/you/store/dumps NEW=$DUMP/schema.sql OLD=$NEW.old DIR=$(pwd) cd $GITREPO mv $NEW $OLD mysqldump -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME --skip-dump-date --single-transaction > $NEW # NOTE : the new schema.sql file & location need to be added to your GIT repo & ignore .old if cmp -s $OLD $NEW; then echo Same else echo Differ git commit $NEW -m "$DBNAME DB update" echo "schema+data committed" git push # assuming you have a remote to push to echo "schema+data pushed" fi cd $DIR