@supawatch/target-seed
v0.14.2
Published
Deterministic FK-aware seed.sql generated from live Postgres by supawatch: topological order, identity overriding, sequence resync.
Maintainers
Readme
@supawatch/target-seed
The seed target for
supawatch. Emits seed.sql:
deterministic, FK-aware seed rows. Parents insert before children,
identity columns get explicit ids via OVERRIDING SYSTEM VALUE,
sequences are resynced with setval, enum labels are real, and the byte
output is stable for an unchanged schema, so the file diffs like code.
targets: [{ kind: "seed", rows: 3 }]Drop the output at supabase/seed.sql and supabase db reset applies
it. The repo's suite proves the hard parts against a real empty
database: an identity-always bigint parent, a uuid parent, FK chains
with a nullable edge, and a post-seed insert that does not collide
because sequences were resynced. Seeded rows are ground-truth checked
against the generated Zod schemas.
Honest limits, emitted as comments rather than guesses: anything the generator cannot fill truthfully is skipped by name rather than approximated. That covers required foreign keys that form a cycle or reference something other than a predictable single-column primary key, multi-column foreign keys, constrained domains, and required columns whose types have no honest literal (composites, unknown types, string types with constrained input syntax like inet or interval).
MIT.
