Files
OwnCord/Server/sqlc.yaml
T
Claude dede2c61a7 phase-a: scaffold postgres backend (schema, queries, store stub, config)
- migrations/postgres/: consolidated pg schema with tsvector FTS, CITEXT
  usernames, native CHECK constraints, native BOOLEAN/TIMESTAMPTZ types
- db/queries/postgres/: 14 sqlc query files dialect-translated from sqlite
  ($N placeholders, NOW(), TRUE/FALSE, ON CONFLICT DO UPDATE, RETURNING id,
  :execrows for mutations needing row count)
- sqlc.yaml: second engine entry -> pgdbgen package under pgx/v5
- Makefile: sqlc-verify covers both dbgen + pgdbgen
- store/postgres.go: PostgresStore behind //go:build postgres, full Store
  interface (112 methods). Connection lifecycle real; query methods stub
  ErrPostgresNotImplemented awaiting pgdbgen wrappers
- config: DatabaseConfig.Type/Host/Port/User/Password/Name/SSLMode/MaxConns
- main.go: explicit dispatch on database.type; postgres errors with clear
  pointer at remaining work until pgdbgen + boundary refactor land
- phase-a-foundation.md: implementation status + actionable TODO checklist
  including forward-only sqlite->postgres data migration design
2026-04-06 07:43:08 +00:00

39 lines
1.4 KiB
YAML

version: "2"
sql:
# ── SQLite backend ────────────────────────────────────────────────────────
- engine: "sqlite"
queries: "db/queries/sqlite"
schema: "migrations"
gen:
go:
package: "dbgen"
out: "db/dbgen"
sql_package: "database/sql"
emit_interface: true
emit_pointers_for_null_types: true
emit_prepared_queries: false
emit_exact_table_names: false
emit_empty_slices: true
emit_json_tags: true
json_tags_case_style: "camel"
# ── PostgreSQL backend (Phase A Step 3) ───────────────────────────────────
# Postgres is opt-in via database.type = "postgres" in owncord.yaml.
# The generated querier lives in a separate package (pgdbgen) so sqlite
# and postgres code can coexist without import collisions.
- engine: "postgresql"
queries: "db/queries/postgres"
schema: "migrations/postgres"
gen:
go:
package: "pgdbgen"
out: "db/pgdbgen"
sql_package: "pgx/v5"
emit_interface: true
emit_pointers_for_null_types: true
emit_prepared_queries: false
emit_exact_table_names: false
emit_empty_slices: true
emit_json_tags: true
json_tags_case_style: "camel"