# `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
- `--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`](../errors/cli.seed_arguments.md): Seed command has invalid arguments
- [`seed.failed`](../errors/seed.failed.md): Seed ended with a failure or a fault
- [`seed.production_refused`](../errors/seed.production_refused.md): Seed refused a database that isn't on this machine
- [`seed.unavailable`](../errors/seed.unavailable.md): Seed's database couldn't be reached
- [`migration.apply_failed`](../errors/migration.apply_failed.md): Migrations could not be applied
- [`toolchain.project_not_found`](../errors/toolchain.project_not_found.md): Project could not be found
