Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --auto-approve to db up #661

Merged
merged 3 commits into from
Jun 15, 2020
Merged

Conversation

rockymeza
Copy link
Contributor

If you try to deploy a change that has a migration that will have data loss, the prisma migrate command will ask the user for confirmation. This is great for local development, but not great for continuous deployment. On Netlify this will cause deployments to just hang:

image

This PR adds an --auto-approve option to yarn rw db up that just applies --auto-approve to the prisma migrate command.

I also think we might want to add this --auto-approve option to the netlify.toml build command.

This will pass --auto-approve to `prisma migrate up`.
@rockymeza
Copy link
Contributor Author

In the meantime, here is a workaround that I've been using

diff --git a/netlify.toml b/netlify.toml
index 92b4c12..05a39df 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -1,5 +1,5 @@
 [build]
-  command = "yarn rw db up --no-db-client && yarn rw build"
+  command = "cd api && yarn prisma migrate up --experimental --auto-approve --create-db && cd .. && yarn rw build"
   publish = "web/dist"
   functions = "api/dist/functions"

@peterp peterp self-assigned this Jun 15, 2020
@peterp
Copy link
Contributor

peterp commented Jun 15, 2020

This is great, I've added this as the default to netlify.toml over here: redwoodjs/create-redwood-app@532495a

I also think it makes a lot of sense to allow arguments (that we don't specify) to be forwarded over to the prisma cli, if we do that then we don't have to add any new code to support things like this.

@peterp peterp added this to the next release milestone Jun 15, 2020
@peterp peterp merged commit 232650a into redwoodjs:master Jun 15, 2020
@jtoar
Copy link
Contributor

jtoar commented Jun 17, 2020

One thing to note if we go that route is that the help message will just have to output a link to the prisma docs to be useful, since yargs uses the options explicitly specified in builder to construct the help message.

Maybe we could "override" help by making it a bona fide argument that just triggers the prisma help output? Then the help output of our commands wouldn't look uniform, but that might not matter that much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants