databacker / mysql-backup

image to enable automated backups of mysql databases in containers
636 stars 178 forks source link

handle views separately from tables #301

Closed deitch closed 4 months ago

deitch commented 4 months ago

Fixes #275

Because we called SHOW TABLES, we mixed in base tables and views. Normally that is fine, their handling is almost identical, but the SHOW CREATE TABLE for views also returns 2 more columns.

This fix creates a Table interface and then has 2 implementations: baseTable and view. view pretty much just embeds baseTable, but overrides CreateSQL(), where it handles the 4 columns correctly.

Also added a test in backup_test.go wherein it creates a view. I expect the initial integration test to fail, but that is a test issue.