Created
August 15, 2019 23:00
-
-
Save catogonzalez/686eef3b729247bf57fcb974b28ce738 to your computer and use it in GitHub Desktop.
Git hooks to automate database snapshots using Stellar
This file contains 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 characters
#!/bin/sh | |
# This is to automate the process of db snapshots with | |
# https://github.com/fastmonkeys/stellar | |
# read current git branch name | |
BRANCH=$(git rev-parse --abbrev-ref HEAD ) | |
if stellar list | grep $BRANCH; then | |
# checkout the existing db snapshot | |
stellar restore $BRANCH | |
else | |
# create a new snapshot from master | |
echo New db snapshot from master | |
stellar restore master | |
stellar snapshot $BRANCH | |
fi |
This file contains 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 characters
#!/bin/sh | |
# This is to automate the process of db snapshots with | |
# https://github.com/fastmonkeys/stellar | |
# read current git branch name | |
BRANCH=$(git rev-parse --abbrev-ref HEAD ) | |
if stellar list | grep $BRANCH; then | |
# update the existing snapshot | |
stellar replace $BRANCH | |
else | |
echo NOT FOUND: $BRANCH | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These are a couple of git hooks that help automate the switching of databases in development using Stellar.
So, whenever you switch to a branch using
git checkout my-branch
you will have created (or restored) a database snapshot withstellar snapshot $BRANCH
.