My current working solution is to go to
My current working solution is to go to prod after deployment and run the convex function using the dashboard
14 Replies
I think you're looking for migrations: https://www.convex.dev/components/migrations
As far as when your production backend updates compared to your frontend, the general approach is to make non-breaking updates to your backend. It's really tough to try and guarantee one is deployed before/after the other.
I may be missing something about your use case, let me know if so.
Okay I just saw this flag
--prod
so what if I do something like this in my package.json
so specifically that prebuild
Assuming that init function is successfully running your migrations, that should work
(or running whatever you want to run on deploy to prod)
yh init runs something let's call it a migration
it just seeds my database if something are missing
the prebuild says convex DEV though
I asked the convex ai and there isn't some
convex prod
cli commandoh duh
yeah not dev
you just want to run the function
convex run
CLI | Convex Developer Hub
The Convex command-line interface (CLI) is your interface for managing Convex
Okay thank you so much I think I understand now
"prebuild": "convex run init --prod"
yh exactly
how does app know if it has to connect to dev or prod environment? based on process.env?
yeah environment variables
well, typically anyway. Your client goes off of the url you pass to the convex client, which is typically
CONVEX_URL
or something. Your local dev cli uses CONVEX_DEPLOYMENT
I believe, which is set in your .env.local
during local devok understand. because i run currently only in dev deployment and my production environment app still can connect to dev automatically without problem
Yeah they're both cloud instances