Skip to content

Check the dev database for pending migrations after compiling - #5426

Open
infomiho wants to merge 1 commit into
mainfrom
issue-4479-static-compile
Open

infomiho wants to merge 1 commit into
mainfrom
issue-4479-static-compile

Conversation

@infomiho

@infomiho infomiho commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Description

To avoid having to do the analysis twice (first we need it to find the database type to start the dev database and then the second time to use the app spec to start the app), I've moved the database check out of compilation and made the compilation "static" (@sodic we talked about this on the call).

The behaviour of wasp compile command stays the same for now (removed the database check so it doesn't print can't find the database every time in #5427

Some nice diagram from Claude:
image

Agreement

  • This is a small, obvious fix (typo, docs corrections, clear small bug with a test).
  • A maintainer agreed on the approach beforehand:

Type of change

  • 🔧 Just code/docs improvement
  • 🐞 Bug fix
  • 🚀 New/improved feature
  • 💥 Breaking change

Checklist

  • I tested my change in a Wasp app to verify that it works as intended.

  • 🧪 Tests and apps:

    • I added unit tests for my change.
    • (if you fixed a bug) I added a regression test for the bug I fixed.
    • (if you added/updated a feature) I added/updated e2e tests in examples/kitchen-sink/e2e-tests.
    • (if you added/updated a feature) I updated the starter templates in waspc/data/Cli/templates, as needed.
    • (if you added/updated a feature) I updated the example apps in examples/, as needed.
      • (if you updated examples/tutorials) I updated the tutorial in the docs (and vice versa).
  • 📜 Documentation:

    • (if you added/updated a feature) I added/updated the documentation in web/docs/.
  • 🆕 Changelog: (if change is more than just code/docs improvement)

    • I updated waspc/ChangeLog.md with a user-friendly description of the change.
    • (if you did a breaking change) I added a step to the current migration guide in web/docs/migration-guides/.
    • I bumped the version in waspc/waspc.cabal to reflect the changes I introduced.

@infomiho
infomiho added this pull request to stack #5428 November 20, 2026 10:32
@infomiho
infomiho temporarily deployed to railway-deploy-test November 20, 2026 10:43 — with GitHub Actions Inactive
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Deploying wasp-docs-on-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3682a16
Status: ✅  Deploy successful!
Preview URL: https://fb72b037.wasp-docs-on-main.pages.dev
Branch Preview URL: https://issue-4479-static-compile.wasp-docs-on-main.pages.dev

View logs

@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@wasp/spec

npx https://pkg.pr.new/@wasp/spec@5426

@wasp/cli

npx https://pkg.pr.new/@wasp/cli@5426

@wasp/cli-darwin-arm64-unknown

npx https://pkg.pr.new/@wasp/cli-darwin-arm64-unknown@5426

@wasp/cli-linux-arm64-glibc

npx https://pkg.pr.new/@wasp/cli-linux-arm64-glibc@5426

@wasp/cli-linux-x64-glibc

npx https://pkg.pr.new/@wasp/cli-linux-x64-glibc@5426

@wasp/cli-linux-x64-musl

npx https://pkg.pr.new/@wasp/cli-linux-x64-musl@5426

commit: 3682a16

@infomiho
infomiho force-pushed the issue-4479-static-compile branch from c282754 to c7165d9 Compare November 20, 2026 13:11
@infomiho
infomiho temporarily deployed to railway-deploy-test November 20, 2026 13:16 — with GitHub Actions Inactive
@infomiho
infomiho force-pushed the issue-4479-static-compile branch from c7165d9 to 64f82f1 Compare November 20, 2026 13:52
@infomiho
infomiho marked this pull request as ready for review November 20, 2026 13:54
@infomiho
infomiho requested review from a team and FranjoMindek November 20, 2026 13:54
@infomiho
infomiho temporarily deployed to railway-deploy-test November 20, 2026 13:58 — with GitHub Actions Inactive

@pullfrog pullfrog 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.

✅ No new issues found.

Approach: sound — moving migration checks to CLI orchestration separates compilation from database availability while preserving development warnings.

Reviewed changes across compilation setup, standalone compilation, startup, and file watching.

  • Static compilation: removes the database-check setup goal and step, exposing the existing check through Wasp.Project.
  • CLI checks: standalone compilation and initial startup check migration state after compilation; startup retains database warnings for later diagnostic output.
  • Recompilation: successful watcher compilations append migration warnings before reporting results.

Local tests could not run: mise tool installation timed out, and the offline Cabal fallback lacked cached Haskell dependencies.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

-- project lock themselves should call 'compile' instead.
compileCommand :: Command ([CompileWarning], AS.AppSpec)
compileCommand = ProjectLock.acquireExclusive compile
compileCommand = ProjectLock.acquireExclusive $ do

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This might look a big heavy, but it's to preserve the current behaviour. We drop this change in a later PR because it mostly always fails (wasp compile won't auto start the database): #5427

FormatPrismaSchema -> formatPrismaSchema generatedAppDir
-- A production build is deployed elsewhere, so there is no local database
-- to check for pending migrations.
WarnIfDbNeedsMigration -> when (AS.isDevelopment spec) $ warnIfDbNeedsMigration spec generatedAppDir

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removes the migration check from the compile setup so compile can be "static".

@infomiho
infomiho force-pushed the issue-4479-static-compile branch 5 times, most recently from 04673c5 to a9df193 Compare November 20, 2026 20:25
Base automatically changed from issue-4479-dev-db-kind to main November 20, 2026 20:25
@infomiho
infomiho force-pushed the issue-4479-static-compile branch from a9df193 to 3682a16 Compare November 20, 2026 20:25
@infomiho
infomiho deployed to railway-deploy-test November 20, 2026 20:34 — with GitHub Actions Active
@infomiho
infomiho deployed to fly-deploy-test November 20, 2026 20:34 — with GitHub Actions Active

This branch was successfully deployed

2 active deployments
railway-deploy-test — 3682a163 Deployed Nov 20, 2026 by infomiho via deploy-test / Test Railway deployment #15780
fly-deploy-test — 3682a163 Deployed Nov 20, 2026 by infomiho via deploy-test / Test Fly deployment #15780
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.

1 participant