Files
project-work/worker-toolkit-stocks-in-the-future/repo/docs/seeds.md
Eric Bell 2854619bc9 chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
2026-08-11 14:44:09 -04:00

40 lines
1.2 KiB
Markdown

# Seeds
## Objectives
- We want to maintain a rich database seed for development since that lays a good
foundation for easy contributions.
- We want to ensure production data integrity by putting stops in place to ensure
the development seed is never accidentally run in production.
- We want to keep our seeds separated into partials to keep things organized
and easy to maintain.
## Running the seeds
To seed your database, simply execute:
```
rails db:seed
```
In either the Development or Production environments. Seeds are idempotent.
## Split between Production and Development
To ensure the execution of seeds in only the appropriate environment the default
```db/seeds.rb``` file has been edited to check the environment and execute the
appropriate seed. **Do not edit this file to add your seeds.**
In the ```db/seeds``` directory you will find files named for each environment:
- ```development.rb```
- ```production.rb```
- ```test.rb```
These are where you will add your seeds.
## Seed partials
The ```db/seeds/partials``` directory contains partials that are loaded by the
respective environment seeds (see above). These will contain the bulk of our seed
code.
As far as is practical we will split these into one file per model.