Skip to content

Extract shared development database lifecycle and options - #5064

Closed
infomiho wants to merge 29 commits into
issue-4479-foreground-dbfrom
issue-4479-db-extraction
Closed

infomiho wants to merge 29 commits into
issue-4479-foreground-dbfrom
issue-4479-db-extraction

Conversation

@infomiho

@infomiho infomiho commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Description

Refactor PR that moves dev DB code into a separate module DevDb. No need to review this one.

Agreement

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.

      Existing tests cover this extraction. Lifecycle and parser definitions are moved unchanged from the parent PR.

    • (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 #5065 October 19, 2026 13:41
@infomiho
infomiho marked this pull request as ready for review October 19, 2026 13:42
@infomiho
infomiho requested a review from a team as a code owner October 19, 2026 13:42
@infomiho
infomiho requested review from cprecioso and removed request for a team October 19, 2026 13:42

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

Reviewed changes across all eight files, comparing the extracted modules and their callers against the parent branch.

  • Shared lifecycle: Moves managed PostgreSQL startup, reuse, readiness, cleanup, and database URL detection into Db.DevDb without changing their behavior.
  • Shared options: Moves DbStartOptions and its parser into Db.StartOptions, updating command callers, parser tests, and Cabal module registration.
  • Standalone command: Keeps Start.Db focused on the foreground command and preserves custom-database errors and environment-variable precedence through the shared detector.

Validation: checked callers and existing parser/lifecycle tests. Local ./run test:cli was blocked before compilation by the missing Hackage index: Error: [Cabal-7107], unknown package: with-utf8 (dependency of waspc). Linux x86_64/aarch64 builds and formatting checks had passed in CI; Haskell test jobs were still pending when inspected.

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

@infomiho
infomiho force-pushed the issue-4479-db-extraction branch from 505cede to 9d4ad5f Compare October 19, 2026 13:55
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

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

Latest commit: 07b1635
Status: ✅  Deploy successful!
Preview URL: https://3e4a88be.wasp-docs-on-main.pages.dev
Branch Preview URL: https://issue-4479-db-extraction.wasp-docs-on-main.pages.dev

View logs

@infomiho infomiho mentioned this pull request Oct 19, 2026
4 of 17 tasks

@infomiho infomiho left a comment •

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.

Moves the database helpers and options out of Start.Db. Their code is unchanged.

import qualified Wasp.Project.Db.Dev.Postgres as Dev.Postgres
import Wasp.Util.Docker (DockerImageName, DockerVolumeMountPath)

data DatabaseStartPolicy = StartNewDatabase | StartOrReuseDatabase

@infomiho infomiho Oct 19, 2026 •

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.

Moved unchanged from Start.Db. Docker helpers stay in Db.Docker.

import Wasp.Db.Postgres (defaultPostgresPort)
import Wasp.Util.Docker (DockerImageName, DockerVolumeMountPath)

data DbStartOptions = DbStartOptions

@infomiho infomiho Oct 19, 2026 •

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.

Type and parser moved unchanged from Start.Db.

InWaspProject waspProjectDir <- require
WaspSpecAvailable <- require
appSpec <- analyze waspProjectDir
throwIfCustomDbAlreadyInUse :: AS.AppSpec -> Command ()

@infomiho infomiho Oct 19, 2026 •

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.

Same DATABASE_URL checks and errors, now using findDatabaseUrlSource.

@infomiho
infomiho force-pushed the issue-4479-db-extraction branch from 9d4ad5f to b0b469f Compare October 19, 2026 14:01
@infomiho
infomiho had a problem deploying to railway-deploy-test October 19, 2026 14:07 — with GitHub Actions Failure
@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@wasp.sh/spec

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/spec@5064

@wasp.sh/wasp-cli

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli@5064

@wasp.sh/wasp-cli-darwin-arm64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-arm64-unknown@5064

@wasp.sh/wasp-cli-darwin-x64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-x64-unknown@5064

@wasp.sh/wasp-cli-linux-arm64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-arm64-glibc@5064

@wasp.sh/wasp-cli-linux-x64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-glibc@5064

@wasp.sh/wasp-cli-linux-x64-musl

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-musl@5064

commit: 89d3925

@infomiho
infomiho force-pushed the issue-4479-db-extraction branch 6 times, most recently from 52c9bb2 to 7ad5ad1 Compare October 20, 2026 15:18
@infomiho
infomiho force-pushed the issue-4479-foreground-db branch from 3e7a627 to c98e54c Compare October 20, 2026 15:33
@infomiho
infomiho force-pushed the issue-4479-db-extraction branch from 7ad5ad1 to d18ce0c Compare October 20, 2026 15:34
@infomiho
infomiho temporarily deployed to railway-deploy-test October 20, 2026 15:49 — with GitHub Actions Inactive
@infomiho
infomiho force-pushed the issue-4479-db-extraction branch from d18ce0c to 89d3925 Compare October 20, 2026 15:57
@infomiho
infomiho temporarily deployed to railway-deploy-test October 20, 2026 16:03 — with GitHub Actions Inactive
@cprecioso
cprecioso removed their request for review October 22, 2026 09:13
@infomiho
infomiho removed this pull request from stack #5065 November 6, 2026 16:08
@infomiho
infomiho force-pushed the issue-4479-foreground-db branch from 278cf99 to b7d1445 Compare November 6, 2026 16:08
@infomiho infomiho closed this Nov 6, 2026
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