edgedb / edgedb-cli

The EdgeDB CLI
https://www.edgedb.com/docs/cli/index
Apache License 2.0
166 stars 23 forks source link

Create `dump --all` and `restore --all` #81

Closed tailhook closed 4 years ago

tailhook commented 4 years ago

Should dump all the databases and all extra metadata stored in the postgres: cfg module data and roles/autentication data.

Current idea, of how it should work:

  1. Use SELECT queries to query cfg module, and create metadata.edgeql file, that contains CONFIGURE, CREATE ROLE and similar commands
  2. Enumerate all the databases, and issue a dump command per database
  3. Concatenate metadata.edgeql and per-database dump into an archive (perhaps .tar)
  4. For now we omit emptiness check on restore --all for the whole instance, but each database is checked as in normal restore.
elprans commented 4 years ago

cfg is an interesting case. because some configuration may actually be stored in the config file (once implemented). Additionally, you may not want to restore all configuration from a backup, because parts of it might be invalid or undesirable for the new instance. As a point of reference, Postgres does not dump its config with pg_dumpall. Understandably, server upgrade needs to preserve config, so we still need an option to dump it, but I'd argue it shouldn't be on by default. Also, it would probably be cleaner to implement DESCRIBE CONFIG that would emit the necessary config statements directly instead of doing SELECT and rendering on the client side.

1st1 commented 4 years ago

it would probably be cleaner to implement DESCRIBE CONFIG that would emit the necessary config statements directly instead of doing SELECT and rendering on the client side.

Big +1.

tailhook commented 4 years ago

Looks like was done in Alpha 4.