-
Notifications
You must be signed in to change notification settings - Fork 7
Seeds maintenance
Erik Hetzner edited this page Apr 18, 2018
·
2 revisions
Seeds are needed by QA, developers and PMs to save time in testing out standard, common use case scenarios without going through an entire workflow every time.
run "bin/update_data". That should take care of most changes. If you're adding something weird, read on . . .
Seeds have become very difficult to maintain manually due to the complexity of the app.
- rake db:rollback STEP=1 #If you already ran your migration(s), roll them back first (otherwise skip this step)
- rake db:drop * #This is required so that unintended changes don't get into the database snapshot*
- rake db:create #Create your recently destroyed database
- rake db:schema:load #Load the schema
- rake db:data:load #This loads the latest seeding environment. This is the same as rake db:seed
- rake db:migrate #The new migration to update the seeds
- <INSERT YOUR COMMAND HERE> # this is where you run any additional commands, rake tasks, etc that make data modifications that you want to be dumped to seeds
- rake db:data:dump #This saves a snapshot of the current state of the database into data.yml. Commit and enjoy.
- Add -
[ ] If I created a migration, I updated the base data.yml seeds file to the PR checklist