Jure
Explore posts from serversCDCloudflare Developers
•Created by Jure on 9/19/2023 in #pages-help
Is possible to run migrations in Pages build command?
I'm not sure what is the right flow to run D1 migrations... If I understand it correctly so far, you have to:
Push migrations with a command:
npx wrangler d1 migrations apply db-name
as a wrangler command from the local env to make changes in the prod. DB
and then push the changed app code (wich rely on new DB schema) to git.
Shouldn't be a migration run right after the deployment in the "build command" like:
npm run build && npx wrangler d1 migrations apply db-name
Is this possible?
I tried the comamnd and got the error:
After creating CLOUDFLARE_API_TOKEN env var I get this error:
6 replies