fix(01): reconcile migration policy - manual via CLI, not auto on startup

- Updated 01-02-PLAN.md Task 3 to NOT run migrations on startup
- Updated must_haves truth: 'run via ZIO effect when invoked' (not 'on startup')
- Updated verification/success_criteria to reflect manual migration
- Updated ROADMAP success criteria #3 to match CONTEXT.md decision

Per CONTEXT.md line 22-23: migrations run manually via CLI command
This commit is contained in:
Jakub Zych
2026-02-04 17:25:27 +01:00
parent 3f1fc59d23
commit db76c5dd91
2 changed files with 12 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ Decimal phases appear between their surrounding integers in numeric order.
**Success Criteria** (what must be TRUE): **Success Criteria** (what must be TRUE):
1. Developer can run `mill run` and see HTTP server responding to requests 1. Developer can run `mill run` and see HTTP server responding to requests
2. Database queries execute with compile-time SQL validation via Quill 2. Database queries execute with compile-time SQL validation via Quill
3. Database migrations run via Migrator service 3. Migrator service exists for running database migrations via CLI (not auto-run on startup)
4. Models use Repository pattern with ZIO effects for data access 4. Models use Repository pattern with ZIO effects for data access
5. Pulumi configuration deploys the application to cloud infrastructure 5. Pulumi configuration deploys the application to cloud infrastructure
**Plans**: 3 plans **Plans**: 3 plans

View File

@@ -14,7 +14,7 @@ autonomous: true
must_haves: must_haves:
truths: truths:
- "Quill compiles SQL queries at compile time (type errors for bad queries)" - "Quill compiles SQL queries at compile time (type errors for bad queries)"
- "Flyway migrations run via ZIO effect" - "Flyway migrations run via ZIO effect when invoked"
- "Migration creates summer_users table in PostgreSQL" - "Migration creates summer_users table in PostgreSQL"
- "GET /ready returns 200 when database is connected, 503 when not" - "GET /ready returns 200 when database is connected, 503 when not"
artifacts: artifacts:
@@ -46,7 +46,7 @@ must_haves:
Integrate PostgreSQL via Quill with compile-time SQL validation and Flyway migrations wrapped in ZIO effects. Integrate PostgreSQL via Quill with compile-time SQL validation and Flyway migrations wrapped in ZIO effects.
Purpose: Establish database connectivity with type-safe queries and version-controlled schema changes. Purpose: Establish database connectivity with type-safe queries and version-controlled schema changes.
Output: Working database layer with migrations and a /ready endpoint that verifies connectivity. Output: Working database layer with migrations service and a /ready endpoint that verifies connectivity.
</objective> </objective>
<execution_context> <execution_context>
@@ -191,10 +191,11 @@ Method.GET / "ready" -> handler {
Update Main.scala to: Update Main.scala to:
- Provide dataSourceLayer to the server - Provide dataSourceLayer to the server
- On startup, run Migrator.migrate and log result - DO NOT run migrations on startup (per CONTEXT.md: migrations run manually via CLI)
- Startup sequence: migrate -> start server - The Migrator service is available but not auto-invoked
Note: The /ready endpoint will return 503 if no database is running, which is correct behavior. Note: The /ready endpoint will return 503 if no database is running, which is correct behavior.
Migrations will be triggered via CLI command in a later phase (Phase 5: CLI Scaffolding).
</action> </action>
<verify> <verify>
With PostgreSQL running: `curl localhost:8080/ready` returns "ready" With PostgreSQL running: `curl localhost:8080/ready` returns "ready"
@@ -208,19 +209,20 @@ Without PostgreSQL: `curl localhost:8080/ready` returns 503
<verification> <verification>
1. `mill compile` succeeds (Quill context compiles) 1. `mill compile` succeeds (Quill context compiles)
2. With PostgreSQL running: 2. With PostgreSQL running:
- `mill run` starts and runs migrations - `mill run` starts server (does NOT auto-run migrations)
- Logs show "Applied N migrations"
- `curl localhost:8080/ready` returns "ready" - `curl localhost:8080/ready` returns "ready"
3. Check database: `psql -d summercms -c "\\dt"` shows summer_users table 3. Migrations can be run manually via Migrator service (CLI integration in Phase 5)
4. Check migrations table: `psql -d summercms -c "SELECT * FROM summer_migrations"` 4. After manual migration: `psql -d summercms -c "\\dt"` shows summer_users table
5. Check migrations table: `psql -d summercms -c "SELECT * FROM summer_migrations"`
</verification> </verification>
<success_criteria> <success_criteria>
- Quill context exists with PostgreSQL configuration - Quill context exists with PostgreSQL configuration
- Flyway migrator runs as ZIO effect on startup - Flyway migrator service exists as ZIO effect (available for CLI invocation)
- V1 migration creates summer_users table with proper schema - V1 migration creates summer_users table with proper schema
- /ready endpoint verifies database connectivity - /ready endpoint verifies database connectivity
- Compile-time SQL validation works (intentional bad query causes compile error) - Compile-time SQL validation works (intentional bad query causes compile error)
- Server starts WITHOUT auto-running migrations
</success_criteria> </success_criteria>
<output> <output>