Skip to content

Document deployment-managed core migrations - #2440

Merged
ascorbic merged 3 commits into
codex/issue-2276-migrations-cloudflarefrom
codex/issue-2276-migrations-docs
Aug 18, 2026
Merged

ascorbic merged 3 commits into
codex/issue-2276-migrations-cloudflarefrom
codex/issue-2276-migrations-docs

Conversation

@ascorbic

@ascorbic ascorbic commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Documents deployment-managed core migrations across database, Cloudflare, CLI, configuration, and schema-evolution guides. It also includes the requested unrelated AGENTS.md workflow clarification.

Closes #2276

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: RFC: Deployment-managed core migrations #2418

The typecheck and changeset items are not applicable to this documentation-only layer. Quick lint, targeted formatting, and the docs build pass. The i18n item is not applicable because this does not change the admin UI.

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: GPT-5 Codex

Screenshots / test output

Non-visual documentation change. The documentation site builds successfully.


Try this PR

Open a fresh playground →

A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.

Tracks codex/issue-2276-migrations-docs. Updated automatically when the playground redeploys.

@changeset-bot

changeset-bot Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 87f83dc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-do 87f83dc Aug 18 2026, 02:32 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache 87f83dc Aug 18 2026, 02:25 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground 2f6911f Aug 13 2026, 11:29 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs 87f83dc Aug 18 2026, 02:32 PM

@ascorbic
ascorbic marked this pull request as ready for review August 12, 2026 16:32
Copilot AI lite review requested due to automatic review settings August 12, 2026 16:32
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Aug 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 the documentation set to describe “deployment-managed” EmDash core database migrations (build emits a manifest; CI/operator applies it; runtime can enforce with check/manual) across configuration, CLI, and deployment guides, and adds a clarifying note in AGENTS.md.

Changes:

  • Documents the new migrations runtime policy (auto/check/manual) and related env override in the configuration reference.
  • Adds/expands CLI and deployment guidance for emdash migrate, including D1/Hyperdrive specifics and an end-to-end “build → migrate → deploy → check” flow.
  • Introduces a dedicated “Manage Core Database Migrations” deployment doc and wires it into the docs sidebar.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/src/content/docs/reference/configuration.mdx Documents the new migrations config block and updates DB adapter option tables.
docs/src/content/docs/reference/cli.mdx Adds emdash migrate reference (options, exit codes) and clarifies JSON output behavior.
docs/src/content/docs/deployment/schema-evolution.mdx Updates schema-evolution guidance to distinguish core migrations from content model changes.
docs/src/content/docs/deployment/database.mdx Expands database/migration docs to cover manifest-driven deployment migrations and new adapter migration credential knobs.
docs/src/content/docs/deployment/core-migrations.mdx New comprehensive guide for deployment-managed core migrations across adapters (incl. D1 serialization and Hyperdrive origin connectivity).
docs/src/content/docs/deployment/cloudflare.mdx Updates Cloudflare deployment steps to provision resources explicitly and run migrations pre-deploy.
docs/astro.config.mjs Adds the new core-migrations page to the deployment sidebar navigation.
AGENTS.md Minor workflow wording clarification and additional migration guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the review/awaiting-author Reviewed; waiting on the author to respond label Aug 12, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR documents the deployment-managed core migrations feature introduced in the preceding chain of PRs, plus a small AGENTS.md workflow clarification. The approach is sound: the feature code already landed, and these docs cover the CLI, adapter config, runtime auto/check/manual modes, D1/Hyperdrive specifics, and CI serialization. I read the changed docs against the implementation in packages/core/src/cli/commands/migrate.ts, packages/core/src/database/migrations/policy.ts, the database adapter descriptors, and the Cloudflare D1/Hyperdrive migration executors. The docs are largely accurate.

I found three real issues to fix before merging:

  1. pnpm deploy is used as a deployment step, but deploy is a built-in pnpm command, not pnpm run deploy. The preceding step already runs pnpm build, so even if a deploy script existed it would rebuild redundantly. The examples should use pnpm exec wrangler deploy.
  2. The D1 setup <Aside> in database.mdx still claims Wrangler provisions the D1 database automatically on first deploy, which directly contradicts the new guidance that D1 must be provisioned separately.
  3. The exit-codes link in core-migrations.mdx points to #exit-codes, which resolves to the generic CLI exit-codes section rather than the emdash migrate-specific table.

The AGENTS.md migration guidance and the workflow clarification are good additions.


Findings

  • [needs fixing] docs/src/content/docs/deployment/core-migrations.mdx:27

    This deployment step uses pnpm deploy, but deploy is a built-in pnpm command (it deploys packages from a workspace), not a shorthand for pnpm run deploy. The previous step already ran pnpm build, so invoking a deploy script here would also rebuild redundantly. Use the explicit Wrangler command, matching the Cloudflare deployment page.

    pnpm exec emdash migrate --expected-target-fingerprint "$EMDASH_TARGET_FINGERPRINT"
    pnpm exec wrangler deploy
    pnpm exec emdash migrate --check
    
  • [needs fixing] docs/src/content/docs/deployment/core-migrations.mdx:139

    The workflow example also uses pnpm deploy. After pnpm build and the migration apply, the correct next step is to deploy the Worker with pnpm exec wrangler deploy; otherwise the built-in pnpm deploy command may run instead of the intended deploy step.

          - run: pnpm exec wrangler deploy
    
  • [needs fixing] docs/src/content/docs/deployment/database.mdx:70

    This D1 setup aside still claims Wrangler provisions the D1 database automatically on first deploy. That contradicts the new deployment-managed migration guidance added on this page and in the Cloudflare/core-migrations pages, which state that D1 databases must be provisioned separately before migrations are applied. Update the aside to stop implying auto-provisioning.

    <Aside>
    	EmDash runs core migrations automatically by default on the first request after deployment,
    	or a deployment can apply them from the build manifest before traffic. You must provision
    	the D1 database separately; see [Manage Core Database Migrations](/deployment/core-migrations/).
    </Aside>
    
  • [suggestion] docs/src/content/docs/deployment/core-migrations.mdx:33

    The anchor #exit-codes resolves to the generic CLI exit-codes section near the bottom of the page, not the emdash migrate-specific exit-codes table. Link to the migrate command section instead, or add an explicit ID to the migrate exit-codes heading in cli.mdx and link to it.

    The [CLI reference](/reference/cli/#emdash-migrate) distinguishes pending, unknown, confirmation, interruption, and operational exit codes.
    

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Aug 12, 2026
@ascorbic
ascorbic force-pushed the codex/issue-2276-migrations-docs branch from 2e03edc to 2d5ca8f Compare August 13, 2026 08:20
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Aug 13, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@2440

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@2440

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@2440

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@2440

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@2440

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@2440

emdash

npm i https://pkg.pr.new/emdash@2440

create-emdash

npm i https://pkg.pr.new/create-emdash@2440

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@2440

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@2440

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@2440

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@2440

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@2440

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@2440

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@2440

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@2440

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@2440

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@2440

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@2440

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@2440

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@2440

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@2440

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@2440

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@2440

commit: 87f83dc

@ascorbic
ascorbic force-pushed the codex/issue-2276-migrations-docs branch from 2d5ca8f to 1d522eb Compare August 13, 2026 08:46
@ascorbic

Copy link
Copy Markdown
Member Author

Addressed all EmDashBot documentation findings in 1d522eb: both deployment examples now use pnpm exec wrangler deploy, the D1 aside requires explicit provisioning, and the exit-code link targets the emdash migrate section. The two Copilot wording findings are fixed in the same commit. The docs build passes.

@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Aug 13, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the right follow-up: it documents the already-landed deployment-managed core migrations feature across database, Cloudflare, CLI, configuration, and schema-evolution guides, plus the requested AGENTS.md workflow clarification. The docs are accurate against the implementation in packages/core/src/cli/commands/migrate.ts and packages/core/src/database/migrations/policy.ts.

The three issues from the previous review are fixed:

  1. docs/src/content/docs/deployment/core-migrations.mdx now uses pnpm exec wrangler deploy in both the inline example and the GitHub Actions workflow.
  2. docs/src/content/docs/deployment/database.mdx no longer claims D1 is auto-provisioned on deploy; it now points readers to the core-migrations guide.
  3. The exit-codes link in core-migrations.mdx now points to /reference/cli/#emdash-migrate, which resolves to the emdash migrate command section added in cli.mdx. (Starlight auto-generates the #emdash-migrate anchor from the ### emdash migrate heading.)

I found one new real issue and one wording suggestion:


Findings

  • [needs fixing] docs/src/content/docs/deployment/cloudflare.mdx:336

    The AI Search setup steps still tell users to run pnpm deploy to deploy the site. As noted in the previous review, deploy is a built-in pnpm command (it deploys packages from a workspace), not a shorthand for a deploy script. Readers following this step will not deploy the Worker. Use the explicit Wrangler command, consistent with the migration-managed deployment example earlier on the same page.

    	pnpm exec wrangler deploy
    
  • [suggestion] AGENTS.md:157

    The new migration guidance has a broken parallel structure: "Test representative upgrades from existing data, retry after partial completion, every supported dialect, and realistically large data shapes." The third and fourth list items lack a verb. Add one so the sentence scans correctly.

    Test representative upgrades from existing data, retry after partial completion, test every supported dialect, and test with realistically large data shapes.
    

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Aug 13, 2026
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview New commits since the last review labels Aug 13, 2026
@ascorbic
ascorbic force-pushed the codex/issue-2276-migrations-docs branch from 1d522eb to ab9fcfa Compare August 13, 2026 08:58
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Aug 13, 2026
@ascorbic
ascorbic force-pushed the codex/issue-2276-migrations-docs branch from ab9fcfa to 70ef0bf Compare August 13, 2026 09:01
@ascorbic

Copy link
Copy Markdown
Member Author

Addressed both findings from the latest EmDashBot review in ab9fcfa (rebased into the current stack head): the remaining AI Search deployment example now uses pnpm exec wrangler deploy, and the AGENTS.md migration-testing sentence has explicit parallel verbs. pnpm lint:quick and the docs pnpm build pass.

@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Aug 13, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the right follow-up PR: it documents the already-landed deployment-managed core migrations feature across database, Cloudflare, CLI, configuration, and schema-evolution guides, plus the requested AGENTS.md workflow clarification. The docs accurately reflect the implementation I traced in packages/core/src/cli/commands/migrate.ts, packages/core/src/database/migrations/policy.ts, the adapter migration executors, and the runtime middleware.

I re-verified the issues raised in the prior review and the two newer findings from that round:

  • ✅ docs/src/content/docs/deployment/core-migrations.mdx uses pnpm exec wrangler deploy in both the inline example and the GitHub Actions workflow.
  • ✅ docs/src/content/docs/deployment/database.mdx no longer claims D1 is auto-provisioned on deploy and now points readers to the core-migrations guide.
  • ✅ The exit-codes link in core-migrations.mdx resolves to /reference/cli/#emdash-migrate, matching the ### emdash migrate heading added in cli.mdx.
  • ✅ docs/src/content/docs/deployment/cloudflare.mdx now uses pnpm exec wrangler deploy for the AI Search deploy step instead of the incorrect pnpm deploy.
  • ✅ The migration guidance in AGENTS.md now has a correct parallel structure.

I also spot-checked the documented CLI options, exit codes, manifest shape, adapter defaults (migrationAuthTokenEnv, migrationConnectionStringEnv, D1/Hyperdrive behavior), runtime modes, and 503 handling against the source, and found no discrepancies. All changed hunks are documentation-only; there are no new logged-out queries, code paths, or AGENTS.md convention violations to flag.

No further findings.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Aug 13, 2026
@ascorbic
ascorbic force-pushed the codex/issue-2276-migrations-docs branch from 70ef0bf to 55231f8 Compare August 13, 2026 09:17
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Aug 13, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the right follow-up documentation PR: it documents the already-landed deployment-managed core migrations feature across database, Cloudflare, CLI, configuration, and schema-evolution guides, plus the requested AGENTS.md workflow clarification. The approach is consistent with EmDash's architecture and the prior approved Discussion.

I re-verified the issues raised in the prior review and spot-checked the implementation against the source code:

  • docs/src/content/docs/deployment/core-migrations.mdx uses pnpm exec wrangler deploy in the inline deployment example and the GitHub Actions workflow.
  • docs/src/content/docs/deployment/database.mdx no longer claims D1 is auto-provisioned on deploy and now points readers to the core-migrations guide.
  • The exit-codes link in core-migrations.mdx resolves to /reference/cli/#emdash-migrate, matching the ### emdash migrate heading added in cli.mdx.
  • docs/src/content/docs/deployment/cloudflare.mdx now uses pnpm exec wrangler deploy for the AI Search deploy step.
  • The migration guidance added to AGENTS.md has a correct parallel structure.

I also re-traced the documented CLI options, exit codes, manifest shape, adapter defaults (migrationAuthTokenEnv, migrationConnectionStringEnv, D1/Hyperdrive behavior), runtime modes (auto/check/manual), EMDASH_MIGRATIONS_MODE override, and 503 handling against packages/core/src/cli/commands/migrate.ts, packages/core/src/database/migrations/policy.ts, packages/core/src/astro/middleware.ts, the adapter migration executors, and the runtime middleware. All changed hunks are documentation-only; there are no new logged-out queries, code paths, or AGENTS.md convention violations to flag.

No further findings.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Aug 13, 2026
@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-rereview New commits since the last review labels Aug 13, 2026
@ascorbic
ascorbic force-pushed the codex/issue-2276-migrations-docs branch from 55231f8 to 2f6911f Compare August 13, 2026 11:23
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/approved Approved; no new commits since labels Aug 13, 2026
@ascorbic
ascorbic force-pushed the codex/issue-2276-migrations-docs branch from 2f6911f to 7178eb5 Compare August 18, 2026 13:08
@ascorbic
ascorbic force-pushed the codex/issue-2276-migrations-docs branch from 7178eb5 to 87f83dc Compare August 18, 2026 14:20
@ascorbic
ascorbic merged commit e7978d3 into main Aug 18, 2026
59 of 86 checks passed
@ascorbic
ascorbic deleted the codex/issue-2276-migrations-docs branch August 18, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support deployment-managed migrations instead of runtime auto-migrations

2 participants