BetterFrame/server/src/shared/db/config.ts
Mitchell R 9b4032ca8a
refactor: decommission SQLite + add UUIDv7 PK migration for existing PG
- Delete sqlite-adapter.ts and migrations.ts (SQLite path removed)
- Remove driver/sqlitePath from all config schemas + sec-config template
- init.ts now PG-only, no SQLite branch
- db-adapter.ts dialect narrowed to "postgres" only
- Add in-place UUIDv7 migration: detects INTEGER PKs in existing PG
  databases, drops FK constraints, ALTER COLUMN TYPE to TEXT for all
  15 entity tables + their FK columns, re-adds FK constraints. Idempotent
  (skips if already TEXT). Existing integer IDs become string "1", "2"
  etc — new inserts use proper UUIDv7 from repository.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-26 13:22:29 +02:00

24 lines
595 B
TypeScript

import * as av from "@anyvali/js";
export const dbConfigSchema = av.object(
{
url: av.string().default(""),
host: av.string().default("postgres"),
port: av.int().min(1).max(65535).default(5432),
database: av.string().default("betterframe"),
user: av.string().default("betterframe"),
password: av.string().default("betterframe"),
poolMax: av.int().min(1).max(1000).default(10),
},
{ unknownKeys: "strip" },
);
export type DbConfig = {
url: string;
host: string;
port: number;
database: string;
user: string;
password: string;
poolMax: number;
};