Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/symandy/databasebackupbundle
A Symfony Bundle to manage database backup
https://github.com/symandy/databasebackupbundle
database-management mysql php symfony symfony-bundle
Last synced: about 1 month ago
JSON representation
A Symfony Bundle to manage database backup
- Host: GitHub
- URL: https://github.com/symandy/databasebackupbundle
- Owner: Symandy
- License: mit
- Created: 2022-03-29T09:00:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-20T09:15:35.000Z (over 1 year ago)
- Last Synced: 2024-10-12T23:05:34.334Z (about 1 month ago)
- Topics: database-management, mysql, php, symfony, symfony-bundle
- Language: PHP
- Homepage:
- Size: 103 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DatabaseBackupBundle
DatabaseBackupBundle is a Symfony Bundle to manage your databases backup.
[![Build](https://github.com/Symandy/DatabaseBackupBundle/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/Symandy/DatabaseBackupBundle/actions/workflows/build.yml)
## Installation
```shell
composer require symandy/database-backup-bundle
```If [Symfony Flex](https://github.com/symfony/flex) is not enabled yet for the bundle (A PR on
[symfony/recipes-contrib](https://github.com/symfony/recipes-contrib) will be submitted soon), add the following lines
to `config/bundles.php`.```php
['all' => true],
...
];
```## Configuration
### YAML configuration
As in the previous part, if Symfony Flex is not enabled, add the following file (`symandy_database_backup.yaml`)
to `config/packages` directory.#### Basic configuration
If the only purpose is to back up the database of the current project, use the basic configuration file.```yaml
symandy_database_backup:
backups:
app:
connection:
url: "%env(DATABASE_URL)%"
strategy:
max_files: 5
backup_directory: "%kernel.project_dir%/backups"
```#### Advanced usages
```yaml
symandy_database_backup:
backups:
foo:
connection:
# driver: !php/const \Symandy\DatabaseBackupBundle\Model\ConnectionDriver::MySQL
driver: mysql# Usage of environment variables as parameters is recommended for connections configuration
configuration:
user: "%app.foo_db_user%"
password: "%app.foo_db_password%"
host: 127.0.0.1 # Already the default value, don't need to be added
port: 3306 # Already the default value, don't need to be added
databases: [foo, bar, baz] # Will only back up these databases
strategy:
max_files: 5 # Number of files kept after a backup (per database)
# backup_directory: "/var/www/backups" # The directory must be created and must have the right permissions
backup_directory: "%kernel.project_dir%/backups"
# backup_directory: ~ # The current directory will be used if no value is passed
date_format: 'Y-m-d-His' # The date format to use in backup files (default: 'Y-m-d')bar:
# Use Doctrine database url env parameter
connection:
url: "%env(DATABASE_URL)%" # url key will ALWAYS override array configuration
configuration:
user: john # Overridden by url
```### Drivers
Only the `mysql` driver is currently available.
## Usage
Once the backups are configured, you only have to run the following command to generate the dumped databases backup files:```shell
php bin/console symandy:databases:backup
```It will generate one file by database in the format `--.sql`.
## Changelog
You can see all the changes between versions here in the [CHANGELOG.md](CHANGELOG.md) or in the GitHub [releases page](https://github.com/Symandy/DatabaseBackupBundle/releases)