forge db-seed
Seed a database with test or initial data.
Command
forge db-seed <file> [--app <name>]
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
| string | yes | Path to seed SQL file |
Flags
| Flag | Type | Default | Notes |
|---|---|---|---|
| string | — | Project or app name filter |
Examples
Seed with data file:
forge db-seed ./seed-data.sql
Seed specific app:
forge db-seed ./seed-data.sql --app my-api
Errors
| Exit code | Meaning |
|---|---|
| 0 | Seed completed successfully |
| 1 | Seed failed |
Pitfalls
- File format — the seed file should contain valid SQL statements.
- Existing data — seeding does not truncate existing tables. Use
statements in the seed file if needed.TRUNCATE
See also
{auto-injected}
Tested against
{auto-injected}