planetscale / cli

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

Can't dump/restore branches containing views (without crappy work arounds) #921

Open disco-infinex opened 1 month ago

disco-infinex commented 1 month ago

These commands will (seemingly?) never work if the branch being dumped/restored contains a view:

pscale database dump "${DB_NAME}" test --output "${BACKUP_DIR}"
pscale branch create "${DB_NAME}" "${NEW_BRANCH}" --from "${SOURCE_BRANCH}" --wait
pscale database restore-dump "${DB_NAME}" "${NEW_BRANCH}" --dir "${BACKUP_DIR}" --overwrite-tables

There are several bugs contributing to this:

Some of this could be avoided if either the dump or restore commands had a way to exclude specific tables/views. The --tables argument works but is painful to use if you have 100 tables and a few views that need excluding every single time.

orware commented 2 weeks ago

@disco-infinex,

I don't typically work with datasets regularly in support that have views so I hadn't gotten a chance to try and verify what you had shared here yet but today I was working with one and definitely experienced the same behavior you described above so I'll see if I can work on some potential improvements for this over the next week or two.

orware commented 2 weeks ago

Looks like I had experienced the issue as well last year: https://github.com/planetscale/cli/issues/701

I'm pretty sure this should be fixable however so I'll review both issues and focus on trying to get a solution put together for this 👍.