edgedb / edgedb-cli

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

Add branch management commands #1204

Closed vpetrovykh closed 5 months ago

vpetrovykh commented 8 months ago

We need to update the CLI in order to make EdgeDB branches usable for developers (see RFC 1025).

We need to add the following commands:

diksipav commented 8 months ago

Form the first read I can only add:

  1. what happens if user deletesedgedb.auto.toml, is that safe?
  2. edgedb branch rename <oldname> <newname> if we want to rename current branch I think we should omit oldname (I also like github's -m, but I guess rename is better in our case since we don't use many abbrevations)
  3. A new project should ask the user for the branch name defaulting to "main". does it make sense that main db branch can be diff from the main VCS branch?
  4. Eventually we need to update our js create tools with edgedb.auto.toml and add it automatically to .gitignore.
vpetrovykh commented 8 months ago
  1. what happens if user deletesedgedb.auto.toml, is that safe?

You'd lose all the mapping between git branches and EdgeDB branches and the default branch to connect to will be whatever is in edgedb.toml (usually just "main"). This is annoying to restore, but relatively safe.

  1. edgedb branch rename <oldname> <newname> if we want to rename current branch I think we should omit oldname (I also like github's -m, but I guess rename is better in our case since we don't use many abbrevations)

Omitting the oldname in renaming is IMO too much magic. The current branch may not be obvious/visible. I was following the logic of OS mv (or rename) command.

  1. A new project should ask the user for the branch name defaulting to "main". does it make sense that main db branch can be diff from the main VCS branch?

Currently our default branch is just "edgedb" for all local projects and I think we default to project name for cloud. You are likely to have more VCS branches than database branches because not everything involves a schema change.

  1. Eventually we need to update our js create tools with edgedb.auto.toml and add it automatically to .gitignore.

Our tools should check .gitignore and offer to add edgedb.auto.toml to it, but this should never be a silent operation, this should be an easy opt-in (just answering a y/n prompt or something like that).