planetscale / cli

The CLI for PlanetScale Database
https://planetscale.com/cli
Apache License 2.0
604 stars 51 forks source link

Improve view support for pscale database dump / restore-dump #932

Closed orware closed 2 weeks ago

orware commented 4 weeks ago

This should address the problem described in the following two issues: https://github.com/planetscale/cli/issues/921 https://github.com/planetscale/cli/issues/701

And adds support for exporting views with the -schema-view.sql suffix, avoids running the view queries and exporting data from them unnecessarily, and allows for restoring / overwriting the views when the --overwrite-tables flag is passed in.

The goal was to implement the desired functionality with minimal changes to the existing files but the new information_schema query that was added in dumper.go did lead to some required additions in the dumper_test.go file.

As I also have PR#910 open at the moment that includes other modifications to dumper.go and loader.go this one may be simpler to review / approve first and then I can update the other pull request afterward.