You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1012 B
46 lines
1012 B
#!/bin/bash
|
|
|
|
### DO NOT EDIT THIS FILE
|
|
|
|
function usage {
|
|
echo
|
|
echoMainTitle "Backup a database"
|
|
echo
|
|
echoSubTitle "Usage:"
|
|
echo
|
|
echo "project-manager db:backup [project-shortname] [env]"
|
|
echo
|
|
echo " [env] can be live, stage, local_live or local_stage"
|
|
echo
|
|
echo "--help Prints this message"
|
|
echo
|
|
}
|
|
|
|
help="$(getParameter "--help" false "$*")"
|
|
if [ "$help" == true ] || [ "$1" == "" ]
|
|
then
|
|
usage
|
|
exit
|
|
fi
|
|
|
|
source "$project_manager_dir/bin/includes/project_header"
|
|
env="$(getArgument "$2" "$(usage)" "live stage local_live local_stage")"
|
|
dbValidate
|
|
|
|
database=$(dbGetConfig "$env" "database")
|
|
|
|
echo
|
|
echoMainTitle "Backup database $env"
|
|
echo
|
|
|
|
echo "Backup structure ..."
|
|
db="$(dbDump "$env" "structure" "--no-data" "$database")"
|
|
echo "Database structure backed up to: $db"
|
|
|
|
echo "Backup data ..."
|
|
db="$(dbDump "$env" "data" "--no-create-info --skip-triggers" "$database")"
|
|
echo "Database data backed up to: $db"
|
|
|
|
echo
|
|
echoSuccess "Database has been backed up"
|
|
echo
|