Created
August 17, 2012 23:57
-
-
Save barraponto/3383529 to your computer and use it in GitHub Desktop.
Automatically dump Drupal database on commit
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/bash | |
# Set overridable filename format | |
: ${DRUPAL_DUMP_FORMAT:="%at-%h"} | |
filename="$( git log -n 1 --format=${DRUPAL_DUMP_FORMAT} ).sql" # see git help log for more on git formats | |
# Set overridable path | |
: ${DRUPAL_DUMP_PATH:="."} # path, relative to drupal root | |
path="$( cd `drush dd` ; realpath $DRUPAL_DUMP_PATH 2>&1 )" | |
# Check if drush is available | |
command -v drush > /dev/null 2>&1 || { echo >&2 "I require drush but it's not installed. Please check http://drush.ws"; exit 1; } | |
drush sql-dump --result-file="${path}/${filename}" --gzip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See companion hook https://gist.github.com/3384457