Files
findr-api/test
mars3142 4c03f45f24
CI / test (push) Successful in 2m12s
CI / build-and-push (push) Successful in 59s
CI / deploy (push) Successful in 5s
Generate primary key UUIDs as v7 at app level
Every table used Postgres's gen_random_uuid() (v4, fully random) as
the id default. Switched to UUIDv7 generated in application code
instead: its leading timestamp keeps new rows appending near the end
of each primary-key index rather than landing at random positions
across it, and rows sort by creation order for free. Generating it in
JS (src/lib/ids.ts) rather than DB-side keeps the id available before
the INSERT runs, same as the defaultRandom() pattern it replaces.

Migration drops the DB-side default on all 13 id columns; Drizzle's
$defaultFn supplies the value from here on.

Verified against a real Postgres insert (id came back version-7
shaped) in addition to the format/uniqueness/ordering unit tests.

Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
2026-09-06 18:05:14 +02:00
..