Add "nkt/backup-bundle": "1.0.x-dev"
into composer.json.
Add Nkt\BackupBundle\NktBackupBundle
into your kernel bundles.
Now you can add new cron job, for backup your application:
0 */6 * * * /path/to/app/console doctrine:database:backup --gzip=-9
You can also restore any backup using
/path/to/app/console doctrine:database:restore /path/to/app/backup/backupname.sql.gz
Backup filename contains driver name, database name and date.
You can change date pattern (by default Y-m-d-H-i-s
)
using --date-pattern
option.
If you using multiply connections, specify it using --connection
option
or -c
flag.
By default all backups saves into path/to/app/backups
, you can change it
using --destination
option or -d
flag.
As you can see in example, you can compress backups using --gzip
option.
This option required value, you have to specify compress quality.
Restore command required filename by first argument. It also support
change connection with --connection
option or -c
flag.
You don't have to specify gzipped file. Command checks does filename
ends with .gz
and decompress it.
MIT