Skip to content

feat(dev): provision a Prisma shadow database for dev leases - #55

Merged
simoncrypta merged 1 commit into
mainfrom
feat/dev-shadow-database
Oct 12, 2026
Merged

simoncrypta merged 1 commit into
mainfrom
feat/dev-shadow-database

Conversation

@simoncrypta

Copy link
Copy Markdown
Collaborator

Prisma migrate dev fails with P3014 because dev lease roles cannot create databases. Dev acquisition now provisions a dedicated role-owned shadow database alongside the main database on one admin connection, preserving the worktree hash when names need shortening.

AcquireResult.shadowDatabaseUrl, CLI JSON/env output, cedarpg run / run --attach, and the dev env file/loaders expose the shadow URL. Re-acquiring keeps both databases; existing role-scoped fresh acquisition, dispose, and GC remove both. README and changelog document the Prisma config opt-in and the one-time re-acquire for existing leases.

Validation:

  • vp check: formatting, lint, and type checking pass.
  • vp test: 145 tests pass across 23 files.
  • vp run smoke: dual ESM/CJS packaging and export resolution pass.
  • vp run smoke:pg: Vitest, Jest, TEMPLATE clone reuse/reset, CLI URL forwarding, and dev shadow checks pass. Prisma 7 generates an initial migration, deploys it, and generates a second migration through run --attach, with CREATEDB still disabled. Live checks also verify re-acquire preserves data and fresh/dispose/GC clean up both databases.

The registered host was unavailable locally, so the live smoke ran against a temporary cluster using autopg's bundled Postgres binary and an attach-only discovery shim. The shared host was not restarted or upgraded, and temporary cluster cleanup stayed under /tmp.

Closes #54

@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 97b775aa-cc1f-45ac-aebe-0ad088335601

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@cedarjs/pg@55

commit: 3148a53

@simoncrypta
simoncrypta merged commit f772184 into main Oct 12, 2026
4 checks passed
@simoncrypta
simoncrypta deleted the feat/dev-shadow-database branch October 12, 2026 21:24
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.

Provide a Prisma shadow database for dev leases (migrate dev fails with P3014)

1 participant