Skip to content

Seeds maintenance

Erik Hetzner edited this page Apr 18, 2018 · 2 revisions

Seeds maintenance

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.

TL;DR

run "bin/update_data". That should take care of most changes. If you're adding something weird, read on . . .

Guide to updating seeds for devs

Seeds have become very difficult to maintain manually due to the complexity of the app.

  1. rake db:rollback STEP=1 #If you already ran your migration(s), roll them back first (otherwise skip this step)
  2. rake db:drop * #This is required so that unintended changes don't get into the database snapshot*
  3. rake db:create #Create your recently destroyed database
  4. rake db:schema:load #Load the schema
  5. rake db:data:load #This loads the latest seeding environment. This is the same as rake db:seed
  6. rake db:migrate #The new migration to update the seeds
  7. <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
  8. rake db:data:dump #This saves a snapshot of the current state of the database into data.yml. Commit and enjoy.

PR checklist

  1. Add - [ ] If I created a migration, I updated the base data.yml seeds file to the PR checklist
Clone this wiki locally