feat(yolo-backup): add ability to ignore tables and databases from MySQL backups #114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds the ability to exclude specific tables and/or databases from MySQL backups when using the
yolo-backupscript. This is useful for skipping temporary data, cache tables, or test databases that don't need to be backed up.Changes
New Environment Variables
MYSQL_IGNORE_TABLES: Space-separated list of tables to exclude from backups (format:database.table)MYSQL_IGNORE_DATABASES: Space-separated list of databases to exclude from backupsImplementation Details
xtrabackup Support
The xtrabackup backup function now builds exclude options dynamically:
--databases-exclude=<database>for each excluded database--tables-exclude=<db.table>for each excluded tablemysqldump Support
The mysqldump backup function implements intelligent database filtering:
--ignore-table=<db.table>for excluding specific tablesMYSQL_IGNORE_DATABASES)information_schema,performance_schema,sys)--databases <filtered_list>when exclusions are present--all-databaseswhen no database exclusions are specifiedUsage Examples
Exclude specific tables:
MYSQL_IGNORE_TABLES="mydb.cache mydb.sessions" yolo-backupExclude entire databases:
MYSQL_IGNORE_DATABASES="test_db temp_db" yolo-backupExclude both tables and databases:
Backward Compatibility
All changes are fully backward compatible:
Testing
bash -n)References
Closes #<issue_number>
Original prompt
Fixes #113
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.