Apply migrations to the remote database
d1 & hyperdrive
// what it does
Runs every unapplied migration in order and records them. Test with --local against your dev DB, then --remote to ship the schema to production. Use -e/--env to target a specific environment's D1 binding when you keep separate prod and staging databases.
// shell
$ wrangler d1 migrations apply <database> --local$ wrangler d1 migrations apply <database> --remote$ wrangler d1 migrations apply <database> --remote --env production// gotcha
Like execute, apply defaults to --local — forgetting --remote means production schema never changes even though the command reports success.