Skip to content

feat: add production D1 database config and fix prod scripts#148

Merged
mahata merged 1 commit intomainfrom
feat/d1-production-env
Mar 27, 2026
Merged

feat: add production D1 database config and fix prod scripts#148
mahata merged 1 commit intomainfrom
feat/d1-production-env

Conversation

@mahata
Copy link
Copy Markdown
Owner

@mahata mahata commented Mar 27, 2026

Summary

  • Add environment-specific D1 database binding, durable objects, and migrations under [env.production] in wrangler.toml so dev and production use separate D1 databases.
  • Add --env production flag to db:migrate:prod and db:seed:prod npm scripts so they resolve the production database ID instead of the top-level "local" placeholder.

Add environment-specific D1 database binding, durable objects, and
migrations under [env.production] in wrangler.toml. Add --env production
flag to db:migrate:prod and db:seed:prod scripts so they resolve the
correct database ID.
Copilot AI review requested due to automatic review settings March 27, 2026 07:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Cloudflare Wrangler configuration and npm scripts to ensure production uses its own D1 database configuration and that production DB commands target the production environment.

Changes:

  • Add [env.production] D1 database + durable object + migrations configuration in wrangler.toml.
  • Update db:migrate:prod and db:seed:prod scripts to pass --env production so Wrangler resolves the production D1 database ID.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
wrangler.toml Adds production environment configuration for D1, durable objects, and migrations.
package.json Updates production DB migration/seed scripts to use --env production.

Comment thread wrangler.toml
NODE_ENV = "production"

[[env.production.d1_databases]]
binding = "mlack_db"
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[[env.production.d1_databases]] uses binding = "mlack_db", but the runtime code/types consistently expect the D1 binding to be DB (e.g., c.env.DB). With the current config, production deployments will have c.env.DB undefined and DB access will fail. Use the same binding name (DB) in the production env (or update all code/types to use the new binding name).

Suggested change
binding = "mlack_db"
binding = "DB"

Copilot uses AI. Check for mistakes.
@mahata mahata merged commit 50a7149 into main Mar 27, 2026
7 checks passed
@mahata mahata deleted the feat/d1-production-env branch March 27, 2026 13:23
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.

2 participants