planetscale / cli

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

`pscale branch create` ignores `--region` when `--restore` is used #874

Closed disco-infinex closed 4 months ago

disco-infinex commented 5 months ago

I'm using pscale branch create to restore a backup to a new branch, ideally in a different region.

If I just specify the region (--region), the branch is created in the correct location:

# Works as expected ✅
pscale branch create platform my-new-branch --from main --region aws-ap-southeast-2

If I just specify the backup id (--restore), the correct data is restored and the branch is created in the parent branches region, as expected (us-west-2 in this case):

# Works as expected ✅
pscale branch create platform my-new-branch --from main --restore EtvjZWF4O1zw

But if I specify both --restore and --region, the region argument seems to be ignored:

# Ignores the region? 🫤
pscale branch create platform my-new-branch --from main --region aws-ap-southeast-2 --restore EtvjZWF4O1zw

At a technical level I can understand why this would occur but it being able to do this would be pretty handy. If the current behaviour is intended, it should at least be mentioned in the docs and the cli should possibly print a warning when run under these conditions.

orware commented 5 months ago

Hello @disco-infinex,

Your comments there at the end about possibly having some mentions of this in the docs / or a warning displayed are probably valid in this case.

At the moment the behavior you are experiencing is expected since within our web UI you are not able to select the region when restoring a backup since the restored branch will be placed back within the same region the backup was originally created in.

Here's a quick example of what the web UI presents when restoring a backup to provide a quick visual showing how the web UI does not include a region selector as a part of the restore process at this time:

image