Expand description
One-time global seeding of the admin database.
The seed data (admin user, infra/system config, signing keys) used to live
in a migration (9999_default_config.sql). It was moved out so the shared
migration set is DDL-only and can be applied to per-user databases without
replicating secrets. The seed now runs here, against the admin database
only.
All correctness guarantees live inside seed.sql itself: it is a single
guarded DO block that takes a transaction-scoped advisory lock (serializing
concurrent boots), skips if the seed_complete marker is already present
(idempotent), and runs atomically (a crash rolls back rather than leaving a
partial seed). So this function only has to ship that script to the admin
pool — which keeps the future Send (no &mut PgConnection held across an
await, unlike an in-Rust transaction) so boot() can be spawned.
Functions§
- seed
- Seeds the admin database (idempotent, concurrency-safe, atomic — see the
module docs and
seed.sql).