database-postgresql
Installation
SKILL.md
PostgreSQL Database Standards
Priority: P0 (FOUNDATIONAL)
Integration patterns and ORM standards for PostgreSQL applications.
Patterns & Architecture
- Repository Pattern: Isolate database logic. Use
@InjectRepository()orPrismaService. - Relationship Integrity: Avoid redundant raw ID columns. Favor relation properties.
Migrations (Strict Rules)
- NEVER use
synchronize: truein production. - Generation: Modify
.entity.ts-> runpnpm migration:generate. - Zero-Downtime: Use Expand-Contract pattern (Add -> Backfill -> Drop) for destructive changes.
- RLS:
typeorm migration:generatecannot detect Row-Level Security. Use rawqueryRunner.query()SQL for RLS.