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
| Flag | Type | Default | Description |
|---|---|---|---|
--url <postgres-url> | string | $DATABASE_URL | Target Postgres URL. Reads from env var if omitted. |
--schema <path> | path | introspect | Schema source. Omit to introspect from the target DB itself. |
--seed <name> | string | random | Seed name for caching/replay. |
--from-cache | flag | off | Require a cache hit; fail with exit 6 if missing. The CI default. |
--reset | flag | off | TRUNCATE target tables before insert. |
--scope <domain> | enum | none | Same as on seedkit new. Used only on cache miss. |
--rows <n> | number | auto | Target row count. Used only on cache miss. |
--max-conn <n> | number | 5 | Connection pool size. Tune for your DB's max_connections. |
--dry-run | flag | off | Plan 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-cacheset but no cached entry for this key.7— DB connection failed.
See also
seedkit new— generate AND provision in one shot.seedkit cache— list what's cached.- GitHub Actions recipe — full workflow.