DocsCLI

seedkit seed

Insert generated data into a Postgres URL you already control. The CI workhorse.


Inserts generated data into an existing Postgres database. Unlike seedkit new, this command does not provision a database — it expects a --url you already have (local Postgres, staging, preview-per-PR, CI).

Synopsis

seedkit seed --url <postgres-url> [options]

Examples

Seed your local DB:

seedkit seed --url postgres://localhost:5432/dev --schema schema.sql

Use a cached seed (no LLM cost):

seedkit seed --url $DATABASE_URL --schema schema.sql --seed my-fixture --from-cache

Truncate first, then seed:

seedkit seed --url $DATABASE_URL --schema schema.sql --seed my-fixture --from-cache --reset

Options

FlagTypeDefaultDescription
--url <postgres-url>string$DATABASE_URLTarget Postgres URL. Reads from env var if omitted.
--schema <path>pathintrospectSchema source. Omit to introspect from the target DB itself.
--seed <name>stringrandomSeed name for caching/replay.
--from-cacheflagoffRequire a cache hit; fail with exit 6 if missing. The CI default.
--resetflagoffTRUNCATE target tables before insert.
--scope <domain>enumnoneSame as on seedkit new. Used only on cache miss.
--rows <n>numberautoTarget row count. Used only on cache miss.
--max-conn <n>number5Connection pool size. Tune for your DB's max_connections.
--dry-runflagoffPlan the insert order and row counts; don't execute SQL.

CI pattern

The canonical workflow:

- name: Seed database
  run: |
    npx seedkit-cli seed \
      --url $DATABASE_URL \
      --schema schema.sql \
      --seed my-fixture --from-cache --reset
  env:
    SEEDKIT_TOKEN: ${{ secrets.SEEDKIT_TOKEN }}
    DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}

--from-cache makes the run deterministic: cache hit → seconds, cache miss → exit 6 (which surfaces as a CI failure, not a silent regeneration).

Exit codes

  • 0 — success.
  • 2 — invalid arguments.
  • 3 — schema parse / introspection failed.
  • 4 — generation failed (cache miss path only).
  • 6--from-cache set but no cached entry for this key.
  • 7 — DB connection failed.

See also