stripe / pg-schema-diff

Go library for diffing Postgres schemas and generating SQL migrations
MIT License
347 stars 25 forks source link

Allow applying plan without confirmation #133

Closed albertwidi closed 4 months ago

albertwidi commented 4 months ago

Currently, the pg-schema-diff apply command requires confirmation to continue the process. For example:

Use the arrow keys to navigate: ↓ ↑ → ← 
? Apply migration with the following hazards: INDEX_BUILD?: 
  ▸ No
    Yes

We want to use the CLI to automatically apply the plan, but it is tricky because the apply command requires us to input the confirmation. It's impossible to bypass the confirmation from the current code/implementation.

Do you think it makes sense to add such a feature?

bplunkett-stripe commented 4 months ago

Yes, so basically a "non-interactive" mode. An alternative is to directly integrate with the go library (i.e., creating a very simple go binary that you call from your system).

I think this is a common enough use case though that we should support it.

Thanks for the feedback! I should be able to implement this pretty quickly.

albertwidi commented 4 months ago

Thank you @bplunkett-stripe 🙏