diff --git a/.planning/phases/03-postgresql-support/03-01-PLAN.md b/.planning/phases/03-postgresql-support/03-01-PLAN.md
index 47c52ca..ddb4569 100644
--- a/.planning/phases/03-postgresql-support/03-01-PLAN.md
+++ b/.planning/phases/03-postgresql-support/03-01-PLAN.md
@@ -18,8 +18,9 @@ must_haves:
truths:
- "PostgresStore implements all 9 Store interface methods with PostgreSQL SQL syntax"
- "PostgreSQL baseline migration creates the same 3 tables as SQLite (updates, tags, tag_assignments)"
- - "RunMigrations is renamed to RunSQLiteMigrations for symmetry; RunPostgresMigrations exists for PostgreSQL"
+ - "RunMigrations is renamed to RunSQLiteMigrations in migrate.go; RunPostgresMigrations exists for PostgreSQL"
- "Existing SQLite migration path is unchanged (backward compatible)"
+ - "Application compiles and all existing tests pass after adding PostgreSQL support code"
artifacts:
- path: "pkg/diunwebhook/postgres_store.go"
provides: "PostgresStore struct implementing Store interface"
@@ -139,16 +140,12 @@ Import alias: `sqlitemigrate "github.com/golang-migrate/migrate/v4/database/sqli
- pkg/diunwebhook/migrate.go (current RunMigrations implementation to rename)
- pkg/diunwebhook/migrations/sqlite/0001_initial_schema.up.sql (schema to translate)
- pkg/diunwebhook/migrations/sqlite/0001_initial_schema.down.sql (down migration to copy)
- - pkg/diunwebhook/export_test.go (calls RunMigrations - must update call site)
- - cmd/diunwebhook/main.go (calls RunMigrations - must update call site)
- go.mod (current dependencies)
pkg/diunwebhook/migrations/postgres/0001_initial_schema.up.sql,
pkg/diunwebhook/migrations/postgres/0001_initial_schema.down.sql,
pkg/diunwebhook/migrate.go,
- pkg/diunwebhook/export_test.go,
- cmd/diunwebhook/main.go,
go.mod,
go.sum
@@ -201,6 +198,7 @@ Import alias: `sqlitemigrate "github.com/golang-migrate/migrate/v4/database/sqli
4. Rewrite `pkg/diunwebhook/migrate.go`:
- Rename `RunMigrations` to `RunSQLiteMigrations` (per RESEARCH.md recommendation)
+ - IMPORTANT: Only rename the function definition in migrate.go itself. Do NOT touch cmd/diunwebhook/main.go or pkg/diunwebhook/export_test.go — those call-site renames are handled in Plan 02.
- Add a second `//go:embed migrations/postgres` directive for `var postgresMigrations embed.FS`
- Add `RunPostgresMigrations(db *sql.DB) error` using `pgxmigrate "github.com/golang-migrate/migrate/v4/database/pgx/v5"` as the database driver
- The pgx migrate driver name string for `migrate.NewWithInstance` is `"pgx5"` (NOT "pgx" or "postgres" -- this is the registration name used by golang-migrate's pgx/v5 sub-package)
@@ -221,14 +219,12 @@ Import alias: `sqlitemigrate "github.com/golang-migrate/migrate/v4/database/sqli
```
- RunPostgresMigrations body follows the exact same pattern as RunSQLiteMigrations but uses `postgresMigrations`, `"migrations/postgres"`, `pgxmigrate.WithInstance`, and `"pgx5"` as the database name
-5. Update the two call sites that reference `RunMigrations`:
- - `cmd/diunwebhook/main.go` line 29: change `diun.RunMigrations(db)` to `diun.RunSQLiteMigrations(db)`
- - `pkg/diunwebhook/export_test.go` line 12 and line 24: change `RunMigrations(db)` to `RunSQLiteMigrations(db)`
+5. Because migrate.go renames `RunMigrations` to `RunSQLiteMigrations` but the call sites in main.go and export_test.go still reference the old name, the build will break temporarily. This is expected — Plan 02 (wave 2) updates those call sites. To verify this plan in isolation, the verify command uses `go build ./pkg/diunwebhook/` (package only, not `./...`) and `go vet ./pkg/diunwebhook/`.
6. Run `go mod tidy` to clean up go.sum.
- cd /home/jean-luc-makiola/Development/projects/DiunDashboard && go build ./... && go test -v -count=1 ./pkg/diunwebhook/ -run TestWebhookHandler 2>&1 | head -30
+ cd /home/jean-luc-makiola/Development/projects/DiunDashboard && go build ./pkg/diunwebhook/ && go vet ./pkg/diunwebhook/
- pkg/diunwebhook/migrations/postgres/0001_initial_schema.up.sql contains `SERIAL PRIMARY KEY`
@@ -241,13 +237,11 @@ Import alias: `sqlitemigrate "github.com/golang-migrate/migrate/v4/database/sqli
- pkg/diunwebhook/migrate.go contains `//go:embed migrations/postgres`
- pkg/diunwebhook/migrate.go contains `pgxmigrate "github.com/golang-migrate/migrate/v4/database/pgx/v5"`
- pkg/diunwebhook/migrate.go contains `"pgx5"` (driver name in NewWithInstance call)
- - cmd/diunwebhook/main.go contains `RunSQLiteMigrations` (not RunMigrations)
- - pkg/diunwebhook/export_test.go contains `RunSQLiteMigrations` (not RunMigrations)
- go.mod contains `github.com/jackc/pgx/v5`
- - `go build ./...` exits 0
- - `go test -count=1 ./pkg/diunwebhook/` exits 0 (all existing SQLite tests still pass)
+ - `go build ./pkg/diunwebhook/` exits 0
+ - `go vet ./pkg/diunwebhook/` exits 0
- PostgreSQL migration files exist with correct dialect. RunMigrations renamed to RunSQLiteMigrations. RunPostgresMigrations added. pgx/v5 dependency in go.mod. All existing tests pass unchanged.
+ PostgreSQL migration files exist with correct dialect. RunMigrations renamed to RunSQLiteMigrations in migrate.go. RunPostgresMigrations added. pgx/v5 dependency in go.mod. Package builds and vets cleanly.
@@ -378,7 +372,7 @@ func NewPostgresStore(db *sql.DB) *PostgresStore {
**IMPORTANT: No mutex.Lock/Unlock anywhere in PostgresStore** (per D-05). No `sync.Mutex` field in the struct.
- cd /home/jean-luc-makiola/Development/projects/DiunDashboard && go build ./... && go vet ./pkg/diunwebhook/
+ cd /home/jean-luc-makiola/Development/projects/DiunDashboard && go build ./pkg/diunwebhook/ && go vet ./pkg/diunwebhook/
- pkg/diunwebhook/postgres_store.go contains `type PostgresStore struct`
@@ -398,7 +392,7 @@ func NewPostgresStore(db *sql.DB) *PostgresStore {
- pkg/diunwebhook/postgres_store.go contains `SetMaxOpenConns(25)` (constructor pool config)
- pkg/diunwebhook/postgres_store.go does NOT contain `sync.Mutex` (no mutex for PostgreSQL)
- pkg/diunwebhook/postgres_store.go does NOT contain `mu.Lock` (no mutex)
- - `go build ./...` exits 0
+ - `go build ./pkg/diunwebhook/` exits 0
- `go vet ./pkg/diunwebhook/` exits 0
PostgresStore implements all 9 Store interface methods with PostgreSQL-native SQL. No mutex. Pool settings configured. CreateTag uses RETURNING id. AssignTag uses ON CONFLICT DO UPDATE. Code compiles and passes vet.
@@ -407,18 +401,18 @@ func NewPostgresStore(db *sql.DB) *PostgresStore {
-1. `go build ./...` succeeds (both stores compile, migrate.go compiles with both drivers)
-2. `go test -v -count=1 ./pkg/diunwebhook/` passes (all existing SQLite tests unchanged)
-3. `go vet ./pkg/diunwebhook/` clean
-4. PostgresStore has all 9 methods matching Store interface (compiler enforces this)
-5. Migration files exist in both `migrations/sqlite/` and `migrations/postgres/`
+1. `go build ./pkg/diunwebhook/` succeeds (both stores compile, migrate.go compiles with both drivers)
+2. `go vet ./pkg/diunwebhook/` clean
+3. PostgresStore has all 9 methods matching Store interface (compiler enforces this)
+4. Migration files exist in both `migrations/sqlite/` and `migrations/postgres/`
+5. Note: `go build ./...` and full test suite will fail until Plan 02 updates call sites in main.go and export_test.go that still reference the old `RunMigrations` name. This is expected.
-- PostgresStore compiles and implements Store interface (go build succeeds)
-- All existing SQLite tests pass (RunMigrations rename did not break anything)
+- PostgresStore compiles and implements Store interface (go build ./pkg/diunwebhook/ succeeds)
- PostgreSQL migration creates identical table structure to SQLite (3 tables: updates, tags, tag_assignments)
- pgx/v5 is in go.mod as a direct dependency
+- migrate.go exports both RunSQLiteMigrations and RunPostgresMigrations