Conversation
- Add Drizzle ORM and Drizzle Kit dependencies and configuration. - Define initial database schema for users and generate migrations. - Create `useDB` utility for type-safe database access in server routes. - Implement GitHub Actions for staging and production deployments. - Update `wrangler.jsonc` with D1 bindings and environment settings. - Expand README with database architecture and migration guides. Enable persistent storage and automated deployment pipelines to ensure database schema consistency across environments. Using Drizzle with D1 provides a serverless SQL solution at the edge with a developer-friendly migration workflow.
Add a new `StagingEnv` interface and update the main `Env` interface to reflect changes in the Cloudflare Worker configuration. Optional bindings are now correctly marked as such to improve type safety. These changes are necessary to support staging-specific environment variables and to accurately represent which bindings are guaranteed to be present at runtime. The file has also been reformatted to use consistent indentation.
Standardize indentation to 2 spaces across the entire file. Improve the readability of complex union types and interface definitions by breaking them into multiple lines. This ensures the generated type definitions align with the project's formatting standards.
- Create `AGENTS.md` with project overview, commands, and patterns. - Add `CLAUDE.md` as a reference to the agent guide. - Remove AI context files from `.gitignore` to track them in the repository. Provide AI assistants and developers with clear context on the project architecture and workflows to improve development efficiency. Tracking these files ensures instructions are shared across the team and available to AI tools.
Update @unhead/vue to version 2.1.4 and add @types/node to the project dependencies. Modify tsconfig.json to enable strict type checking and enforce consistent casing in filenames. These changes keep dependencies up to date, provide better type safety for Node.js APIs, and enforce stricter coding standards to prevent potential runtime errors and cross-platform file naming issues.
Replace "latest" version tags with explicit version numbers for all dependencies and devDependencies in the lockfile. Using "latest" makes builds non-deterministic and prone to breaking when upstream packages release updates. Pinning these versions ensures environment stability and consistent behavior across different installations.
Rename `db:migrate:local` to `db:migrate` in package.json and AGENTS.md. Remove the extensive database documentation section from README.md. The database documentation is removed from the main README to keep the file concise and focused on the project overview. The migration script is renamed to provide a shorter and more standard command for local development.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
affirm | 1018027 | Feb 08 2026, 07:54 PM |
There was a problem hiding this comment.
Pull request overview
Integrates Drizzle ORM + D1 into the Nuxt/Cloudflare Workers stack, adds initial schema/migrations, and wires up staging/production deployment workflows to keep D1 migrations consistent across environments.
Changes:
- Add Drizzle schema (
users) + generated migrations and auseDBhelper for type-safe D1 access via the WorkerDBbinding. - Update Wrangler config for migrations + introduce a dedicated
stagingenvironment with its own D1 binding. - Add CI/CD workflows for staging branch deploys and production deploys on
main, plus TypeScript/workspace config updates.
Reviewed changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| wrangler.jsonc | Adds migrations_dir and declares a separate staging D1 database binding. |
| worker-configuration.d.ts | Updates generated Worker env typings (incl. optional bindings + staging env shape). |
| tsconfig.json | Enables stricter TS settings at the root config. |
| server/utils/db.ts | Introduces useDB(event) helper to create a typed Drizzle client from event.context.cloudflare.env.DB. |
| server/database/schema.ts | Adds initial users table schema with timestamps. |
| server/database/migrations/meta/_journal.json | Adds Drizzle migration journal metadata. |
| server/database/migrations/meta/0000_snapshot.json | Adds the snapshot metadata for the initial schema state. |
| server/database/migrations/0000_opposite_oracle.sql | Adds the first SQL migration creating users + unique email index. |
| server/database/index.ts | Re-exports schema (entry point for DB exports). |
| package.json | Adds Drizzle deps and database/migration/studio scripts. |
| drizzle.config.ts | Adds Drizzle Kit configuration targeting D1 HTTP driver. |
| bun.lock | Lockfile updates for the new/updated dependencies. |
| README.md | Documents the new server/database and server/utils structure elements. |
| PROMPTS.md | Adds agent prompt history/context for the DB workflow work. |
| CLAUDE.md | Adds Claude context file (symlink/indirection to agent guide). |
| AGENTS.md | Adds an AI/developer guide covering workflows and DB patterns. |
| .trunk/trunk.yaml | Bumps trufflehog linter version. |
| .gitignore | Stops ignoring AI context files so they can be tracked in-repo. |
| .github/workflows/staging.yaml | New workflow to migrate + deploy on staging branch pushes. |
| .github/workflows/ci.yaml | Adds gated production migrate + deploy job on main pushes. |
| .env.example | Adds CLOUDFLARE_DATABASE_ID example var for tooling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .$defaultFn(() => new Date()), | ||
| updatedAt: integer("updated_at", { mode: "timestamp" }) | ||
| .notNull() | ||
| .$defaultFn(() => new Date()), |
There was a problem hiding this comment.
updatedAt is defined with only a default value, so it will not change on updates unless every update explicitly sets it. If the intent is an auto-maintained "last modified" column, add an on-update hook (e.g., Drizzle's on-update function support) or handle it centrally in update helpers to keep the column consistent.
| .$defaultFn(() => new Date()), | |
| .$defaultFn(() => new Date()) | |
| .$onUpdate(() => new Date()), |
🗃️ (db): integrate Drizzle ORM with Cloudflare D1 and setup CI/CD
useDButility for type-safe database access in server routes.wrangler.jsoncwith D1 bindings and environment settings.Enable persistent storage and automated deployment pipelines to ensure
database schema consistency across environments. Using Drizzle with D1
provides a serverless SQL solution at the edge with a developer-friendly
migration workflow.
🏷️ (worker-configuration.d.ts): update environment types and formatting
Add a new
StagingEnvinterface and update the mainEnvinterface toreflect changes in the Cloudflare Worker configuration. Optional
bindings are now correctly marked as such to improve type safety.
These changes are necessary to support staging-specific environment
variables and to accurately represent which bindings are guaranteed to
be present at runtime. The file has also been reformatted to use
consistent indentation.
🎨 (worker-configuration.d.ts): reformat with consistent indentation
Standardize indentation to 2 spaces across the entire file. Improve the
readability of complex union types and interface definitions by breaking
them into multiple lines. This ensures the generated type definitions
align with the project's formatting standards.
🌈 sync
📝 Add AI agent development guide and track context files
AGENTS.mdwith project overview, commands, and patterns.CLAUDE.mdas a reference to the agent guide..gitignoreto track them in the repository.Provide AI assistants and developers with clear context on the project
architecture and workflows to improve development efficiency. Tracking
these files ensures instructions are shared across the team and available
to AI tools.
⬆️ Upgrade @unhead/vue and enhance TypeScript configuration
Update @unhead/vue to version 2.1.4 and add @types/node to the project
dependencies. Modify tsconfig.json to enable strict type checking and
enforce consistent casing in filenames.
These changes keep dependencies up to date, provide better type safety
for Node.js APIs, and enforce stricter coding standards to prevent
potential runtime errors and cross-platform file naming issues.
📌 Pin dependencies to specific versions
Replace "latest" version tags with explicit version numbers for all
dependencies and devDependencies in the lockfile.
Using "latest" makes builds non-deterministic and prone to breaking when
upstream packages release updates. Pinning these versions ensures
environment stability and consistent behavior across different
installations.
📝 simplify database documentation and rename migration script
Rename
db:migrate:localtodb:migratein package.json and AGENTS.md.Remove the extensive database documentation section from README.md.
The database documentation is removed from the main README to keep the
file concise and focused on the project overview. The migration script is
renamed to provide a shorter and more standard command for local
development.