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:
@@ -32,7 +32,7 @@ Decimal phases appear between their surrounding integers in numeric order.
|
||||
**Success Criteria** (what must be TRUE):
|
||||
1. Developer can run `mill run` and see HTTP server responding to requests
|
||||
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
|
||||
5. Pulumi configuration deploys the application to cloud infrastructure
|
||||
**Plans**: 3 plans
|
||||
|
||||
@@ -14,7 +14,7 @@ autonomous: true
|
||||
must_haves:
|
||||
truths:
|
||||
- "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"
|
||||
- "GET /ready returns 200 when database is connected, 503 when not"
|
||||
artifacts:
|
||||
@@ -46,7 +46,7 @@ must_haves:
|
||||
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.
|
||||
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>
|
||||
|
||||
<execution_context>
|
||||
@@ -191,10 +191,11 @@ Method.GET / "ready" -> handler {
|
||||
|
||||
Update Main.scala to:
|
||||
- Provide dataSourceLayer to the server
|
||||
- On startup, run Migrator.migrate and log result
|
||||
- Startup sequence: migrate -> start server
|
||||
- DO NOT run migrations on startup (per CONTEXT.md: migrations run manually via CLI)
|
||||
- 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.
|
||||
Migrations will be triggered via CLI command in a later phase (Phase 5: CLI Scaffolding).
|
||||
</action>
|
||||
<verify>
|
||||
With PostgreSQL running: `curl localhost:8080/ready` returns "ready"
|
||||
@@ -208,19 +209,20 @@ Without PostgreSQL: `curl localhost:8080/ready` returns 503
|
||||
<verification>
|
||||
1. `mill compile` succeeds (Quill context compiles)
|
||||
2. With PostgreSQL running:
|
||||
- `mill run` starts and runs migrations
|
||||
- Logs show "Applied N migrations"
|
||||
- `mill run` starts server (does NOT auto-run migrations)
|
||||
- `curl localhost:8080/ready` returns "ready"
|
||||
3. Check database: `psql -d summercms -c "\\dt"` shows summer_users table
|
||||
4. Check migrations table: `psql -d summercms -c "SELECT * FROM summer_migrations"`
|
||||
3. Migrations can be run manually via Migrator service (CLI integration in Phase 5)
|
||||
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>
|
||||
|
||||
<success_criteria>
|
||||
- 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
|
||||
- /ready endpoint verifies database connectivity
|
||||
- Compile-time SQL validation works (intentional bad query causes compile error)
|
||||
- Server starts WITHOUT auto-running migrations
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
|
||||
Reference in New Issue
Block a user