Phase 3 — Postgres works end-to-end
Goal
Full PostgresBackend impl of Database trait. TrapFall runs on Postgres with feature parity to SQLite.
Tasks
Migration files structure
crates/trapfall-db/migrations/
├── sqlite/
│ ├── 001_initial.sql
│ ├── 002_alert_rules.sql
│ └── 003_drop_api_keys.sql
└── postgres/
├── 001_initial.sql
├── 002_alert_rules.sql
└── 003_drop_api_keys.sql
Acceptance Criteria
Effort
~2-3 days
Depends on
#166 (Phase 1), #167 (Phase 2)
Future enhancements (out of scope)
- JSONB for
events.data (Phase: postgres-native)
tsvector for full-text search (Phase: postgres-native)
LISTEN/NOTIFY for WebSocket hub (Phase: postgres-native)
pg_partman for time-based partitioning (Phase: postgres-native)
Phase 3 — Postgres works end-to-end
Goal
Full
PostgresBackendimpl ofDatabasetrait. TrapFall runs on Postgres with feature parity to SQLite.Tasks
crates/trapfall-db/src/postgres.rs?→$1, $2, ...parameter bindingdatetime('now')→NOW()AUTOINCREMENT→SERIAL/BIGSERIALINSERT OR IGNORE→ON CONFLICT DO NOTHINGINSERT OR REPLACE→ON CONFLICT DO UPDATERANDOMBLOB()→gen_random_bytes()LIKE→ILIKEfor case-insensitivesqlite_trigram→pg_trgmextensionPostgresBackend(mirrorSqliteBackendlogic)#[cfg(feature = "postgres")]guards#[cfg(feature = "sqlite")]vs#[cfg(feature = "postgres")](Option B from plan)Migration files structure
Acceptance Criteria
PostgresBackendimplements allDatabasetrait methodspg_trgm)Effort
~2-3 days
Depends on
#166 (Phase 1), #167 (Phase 2)
Future enhancements (out of scope)
events.data(Phase: postgres-native)tsvectorfor full-text search (Phase: postgres-native)LISTEN/NOTIFYfor WebSocket hub (Phase: postgres-native)pg_partmanfor time-based partitioning (Phase: postgres-native)