# `jadpo seed`

Fill the development database from a seed.

Run a seed, `database/seeds/<name>.jadpo`, against the development database (area 5): its calls go through the app's own actions, so validation, lifecycles and policy apply, and a call that passes a caller runs as them. The database is the one --url names, else the address its connection's setting gives, else the one a running `jadpo dev` started. It must be on this machine: a database anywhere else may be production, and is refused before anything runs. Pending migrations are applied first. Mail lands in the dev inbox and provider calls are faked, as under `jadpo dev`. A failure stops the seed, and what its earlier calls committed stays.

```text
jadpo seed [name]
```

## Arguments

- `name` (optional): The seed's file name in database/seeds/, without .jadpo

## Flags

- `--url <url>`: The database to seed, on this machine

## On every command

- `--json`: Print data for tools instead of text
- `--full`: Show everything a report shortens
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo seed --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"seed"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# Give the development database its first users
jadpo seed first_users
# Seed a database named directly
jadpo seed local_demo --url postgresql://localhost/library_dev
```

## Errors

- [`cli.seed_arguments`](/docs/errors/cli.seed_arguments.md): A `jadpo seed` command names no seed, one the project doesn't have, or more than one
- [`seed.failed`](/docs/errors/seed.failed.md): A seed `jadpo seed` ran stopped at a call that failed or faulted, and the calls before it stay in the database
- [`seed.production_refused`](/docs/errors/seed.production_refused.md): A seed was run against a database that isn't on this machine, which may be production
- [`seed.unavailable`](/docs/errors/seed.unavailable.md): The database a seed runs against couldn't be reached, so nothing was run
- [`migration.apply_failed`](/docs/errors/migration.apply_failed.md): Applying the project's migrations to a database stopped at a step that failed
- [`migration.drop_not_accepted`](/docs/errors/migration.drop_not_accepted.md): A migration removes data, and no acceptance in the project says a person agreed to it
- [`migration.extension_missing`](/docs/errors/migration.extension_missing.md): The project's migrations need a PostgreSQL extension, such as pgvector, that the database server doesn't offer or that the role applying them can't create
- [`migration.extension_outdated`](/docs/errors/migration.extension_outdated.md): The database server's PostgreSQL extension, such as pgvector, is older than the project's migrations and queries need
- [`migration.store_diverged`](/docs/errors/migration.store_diverged.md): The migrations a database has applied don't match the project's: one has changed since it ran, the project doesn't have one, or one comes out of order
- [`toolchain.project_not_found`](/docs/errors/toolchain.project_not_found.md): You ran a command that works on a project in a folder with no `app.jadpo`, in it or in any folder above it
