hominem-database
Installation
SKILL.md
Hominem database
packages/db is PostgreSQL access code and server-only. Client code uses @hominem/rpc, never the database package directly.
Local development: migrations, codegen, and repositories
Migrations and generated types
packages/db/src/types/database.tsis generated bykysely-codegen; never edit it manually as the final state. After writing or editing a migration, immediately runjust db migratethenjust db codegenyourself against the already-running local dev database (andjust db migrate testif a test database is running) — do not leave this for the user to do. A hand-editeddatabase.tsis only a stopgap for typechecking mid-task; it must be replaced by real codegen output before the change is considered done.- Migrations live in
packages/db/migrations/, use Goose SQLUpandDownmarkers, and are idempotent because CI runsgoose uptwice. - The schemas are
auth,app, andops.pgcrypto,pg_trgm,unaccent,vector,earthdistance,ltree, andfuzzystrmatchare already installed; do not create them again.
After any schema change:
just db migrate # apply migrations using DATABASE_URL
just db codegen # regenerate Kysely types using DATABASE_URL