blitz db migrate should accept arguments to pass to prisma migrate

Created on 28 May 2020  Â·  11Comments  Â·  Source: blitz-js/blitz

What do you want and why?

prisma migrate save current accepts these parameters:

  --help / -h
  --name / -n
  --preview / -p
  --create-db / -c
  --experimental
  --schema

blitz db migrate runs prisma migrate save with the following parameters for us:

  --create-db 
  --experimental
  --schema

For most times, this is sufficient. But sometimes, we might want a bit more control especially to define the migration name via --name. Also, if prisma adds more parameters in future we are covered.

This request is so that we can run blitz db migrate with additional parameters which would be passed to prisma migrate save

Possible implementation(s)

Make changes here to accept args and send with the spawn function:

https://github.com/blitz-js/blitz/blob/dc9c9756ae85323db8d500d68d3f40286d27c018/packages/cli/src/commands/db.ts#L42

Additional context

  • What happens if use parameters that are already defined, like --schema?
  • Should we allow to override --schema?
good second issue kinfeature-change scopcli statudone

All 11 comments

Great, thank you!

I think we should allow overriding any parameter that blitz includes by default.

I want to work in this, Can I take this issue?

@kevotovar you bet!

Hey @kevotovar did you make any progress on this?

@flybayer
Can I work on this?

@nitaking yes! Let me know if you need any help!

Even if the args are unsupported, you can run run runPrisma once and then run
Is it okay to go in the direction of showing "Uh oh, Blitz does not support that command." in case of an error?
(The rest of the logic remains the same.)

I think that's probably ok, but I'm not sure I understand what you mean by "you can run run runPrisma once and then run" 🤔

Supported arguments: Execute (as existing)
Not supported arguments : Execute runPrisma for now
 -> "not support" if an error occurs.

This is what I wanted to convey…😇
(I must learn more English!)

Ok yes I think that'll be fine. I can review for sure once you open a PR. By the way, you can open a PR now with what you have and click the button that marks it as "draft". If it's marked as draft, then we know it's not finished. After you finish, then mark as "ready for review".

Here's the github docs for that.

Thank you for being so gracious!

Was this page helpful?
0 / 5 - 0 ratings