Skip to content

Commit

Permalink
disable skip comments only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
fradelg committed Dec 8, 2024
1 parent dc253cd commit cff595e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ do
echo "==> Dumping database: $db"
FILENAME=/backup/$DATE.$db.sql
LATEST=/backup/latest.$db.sql
if mysqldump --single-transaction --skip-comments $MYSQLDUMP_OPTS -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $MYSQL_SSL_OPTS "$db" > "$FILENAME"
BASIC_OPTS="--single-transaction"
if [ -n "$REMOVE_DUPLICATES" ]
then
echo "WARNING: disabling comments in backup to remove deuplicate backups. Automatic database name detection won't work so set MYSQL_DATABASE on restore"
BASIC_OPTS="$BASIC_OPTS" --skip-comments
fi
if mysqldump $BASIC_OPTS $MYSQLDUMP_OPTS -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $MYSQL_SSL_OPTS "$db" > "$FILENAME"
then
EXT=
if [ -z "${USE_PLAIN_SQL}" ]
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
environment:
- MYSQL_HOST=my_mariadb
- MYSQL_USER=root
- MYSQL_DATABASE=${DATABASE_NAME}
- MYSQL_PASS=${MARIADB_ROOT_PASSWORD}
- MAX_BACKUPS=1
- INIT_BACKUP=1
Expand Down

0 comments on commit cff595e

Please sign in to comment.