supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.02k stars 199 forks source link

`supabase migration new` should take a new flag `-sql-from-file` #2616

Open irohitb opened 4 weeks ago

irohitb commented 4 weeks ago

Is your feature request related to a problem? Please describe.

I want to apply new migrations from a file instead of always using db diff command.

Similar to how hasura `-sql-from-file`` option

https://hasura.io/docs/latest/hasura-cli/commands/hasura_migrate_create/

Describe the solution you'd like

supabase migration new should take a new flag -sql-from-file

Describe alternatives you've considered

Currently, I would do supabase migration new schema_test and then manually copy-paste my migration.

I am building a cli which takes the difference from my source tree and apply migrations with more context (easier to review) instead of supabase creating migrations using supabase db diff

PS: Would like to/insist on creating a PR to add this feature if others also think it would be useful

irohitb commented 4 weeks ago

^^ @sweatybridge

sweatybridge commented 4 weeks ago

Would you consider using unix pipes which is supported currently?

cat other_migration.sql | supabase migration new my_migration
irohitb commented 4 weeks ago

@sweatybridge that works but do you think it won't be a good to have feature?