disable skip comments only when needed

This commit is contained in:
Fco. Javier Delgado del Hoyo 2024-12-08 13:56:43 +01:00
parent dc253cd1ea
commit cff595e634
2 changed files with 8 additions and 1 deletions

View file

@ -29,7 +29,13 @@ do
echo "==> Dumping database: $db" echo "==> Dumping database: $db"
FILENAME=/backup/$DATE.$db.sql FILENAME=/backup/$DATE.$db.sql
LATEST=/backup/latest.$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 then
EXT= EXT=
if [ -z "${USE_PLAIN_SQL}" ] if [ -z "${USE_PLAIN_SQL}" ]

View file

@ -30,6 +30,7 @@ services:
environment: environment:
- MYSQL_HOST=my_mariadb - MYSQL_HOST=my_mariadb
- MYSQL_USER=root - MYSQL_USER=root
- MYSQL_DATABASE=${DATABASE_NAME}
- MYSQL_PASS=${MARIADB_ROOT_PASSWORD} - MYSQL_PASS=${MARIADB_ROOT_PASSWORD}
- MAX_BACKUPS=1 - MAX_BACKUPS=1
- INIT_BACKUP=1 - INIT_BACKUP=1