Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve view support for pscale database dump / restore-dump (#932)
* Added better support for views within dumper.go Currently, `dumper.go` is able to export view definitions without issue, but it unfortunately also runs the view and includes, or attempts to include, the data associated with the view too which is unnecessary. The changes here add support for collecting the list of views so that processing can be slightly adjusted if a "table" is actually a view. In that situation, the same `-schema-view.sql` file suffix is utilized that the MyDumper project uses for views and the step that unnecessarily runs the view query is skipped to avoid that issue. * Added better support for views within loader.go The changes made to `loader.go` add support for collecting any files ending in the view suffix, `-schema-view.sql`, and processing them slightly differently than in `restoreTableSchema()`. The main change within the new `restoreViews()` method, aside from some variable name adjustments and the use of the `viewSuffix`, is the change to using `DROP VIEW` during the overwrite step to properly allow for deleting the existing views. Additionally, the creation of the views is set to occur after the creation of the tables to help avoid that dependency issue. * Adding test fixes for dumper_test.go Some additional cases for the new `information_schema` query needed to be accounted for in the tests.
- Loading branch information