Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Option to export structure for each database individually #15

Open
jurgenhaas opened this issue Jan 10, 2018 · 2 comments

Comments

@jurgenhaas
Copy link
Contributor

Currently the script generates daily, weekly and monthly schema exports for all databases at once in the fullschema subdirectory. We do require schema files for each database individually and would like to implement that in a PR if we can agree with the maintainers on the approach to take.

What's our use case?

We are hosting Drupal sites with multiple sites on each host and each site has their own mysql db. As those databases contain session and caching tables that are not required for the backups, we do exclude them with the CONFIG_table_exclude configuration settings.

In cases where we have to restore a backup for an individual Drupal database, we first drop the database and then source the backup file which will then recreate all the tables except those that got excluded. But we can't use the fullschema either, because that would have an impact on other databases on the same host which we don't want at that time.

If we had a schema file matching each of the dumps, we could first source that schema file followed by sourcing the dump and then would get exactly what we were looking for.

Proposed solution:

There should be a new config option (defaults to "no") which could be set to "yes" if one was looking for individual db schema files. If that was turned on, in process_dbs() we could simply execute a second command which also dump the schema and appends .schema to the filename.

What do you think?

jurgenhaas added a commit to jurgenhaas/AutoMySQLBackup that referenced this issue Aug 2, 2018
This impülements the feature request sixhop#15
@kdebisschop
Copy link

I know this is old. But we have exactly the same need. In our case, I would think maybe pairing your changes. with code to ignore tables with database wildcards -- so we could ignore '.cache_' for the data but keep all the tables when dumping the schema.

@jurgenhaas
Copy link
Contributor Author

I stopped waiting for the maintainers to respond here, so I have copied the file over to my self-hosted GitLab instance and continued maintenance for my own needs over there. You are welcome to grab it and use it as well, if it suits your needs too. You can find it at https://gitlab.lakedrops.com/ansible/roles/mysql/-/blob/master/templates/automysqlbackup.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants