sample_name_1 rows a new Forge project starts with by rows that read like your shop: real product names, sensible prices, reviews with real text and recent dates, without writing seed SQL for the bulk of it.
Forge reads the schema your migrations apply, so it knows every type, foreign key and CHECK constraint. What a column means is the one thing it cannot know, and db/seeds/vocab.yaml is where you say it.
Before you begin
- The
shopproject with itsproductsandreviewstables, from Add a database table with a CRUD API and pages. - Forge v1.6 or later. Inside Reliant, run it as
reliant forge. - Docker, for the local stack. No account.
1
Start the stack and let it seed
The first It seeds 20 rows per table, only for your CRUD entities’ tables and the tables they require through a foreign key.
env up on an empty dev database seeds it:terminal
Output (trimmed)
--no-seed skips it for one run.2
Look at what it wrote
db query runs one read-only statement against an environment’s database:terminal
sample_<column>_<n>, and a numeric column with no CHECK seeds as the row number: a price of one cent.3
Describe your columns in vocab.yaml
db/seeds/vocab.yaml is yours. Add value pools, numeric ranges and time ranges relative to today:db/seeds/vocab.yaml
4
Add the rows a demo needs
Each column is drawn on its own, so rows are valid but not coherent. Write rows a demo needs in
db/seeds/custom/, which runs after the generated rows:db/seeds/custom/demo.sql
5
Reseed the dev database
db seed apply never changes existing rows. After a vocabulary change, db seed reset deletes the rows Forge seeded and seeds again:terminal
6
Verify the data
terminal
Chemex 8-Cup Classic is your custom row. Names repeat because five names cover 20 rows; only a UNIQUE column is drawn without repeats. reliant forge db seed status --dsn <url> prints row counts per table.Then run reliant forge generate: the frontend’s mock mode serves the same rows from fixtures that pick up a vocabulary change only on generate.What this does not do
- No seeding outside dev.
applyandresetrefuse every other environment, and the seeder is not in your server binary. - No coherent rows from vocab.yaml. A review’s text is unrelated to its rating; rows that must agree belong in
db/seeds/custom/.
Troubleshooting
database connection string required: pass --dsn or set DATABASE_URL
database connection string required: pass --dsn or set DATABASE_URL
db seed status needs the database named. Pass --dsn with the DATABASE_URL from reliant forge env config dev.apply refuses and prints COMMENT ON CONSTRAINT ... IS 'forge:ref ...'
apply refuses and prints COMMENT ON CONSTRAINT ... IS 'forge:ref ...'
A table reaches one parent through two foreign keys. Decide which route is the truth, add the printed statement in a migration, and seed again.
Next steps
Build the UI before the backend
Serve the same rows to the frontend with no API running
Test against real Postgres
Run handler tests on a real database
Adding a feature
The everyday loop: services, RPCs, migrations, the gate
forge CLI
Every
reliant forge command