Data Setup - rubyforgood/casa GitHub Wiki

For CASA, afterparty tasks SHOULD run in production. Seed should NOT run in production.

afterparty tasks are run:

  1. once in qa (until we delete the db... which has happened and will probably happen again, but which I would rather not do in general)
  2. once in staging (until we delete the db... which has happened and will probably happen again, but which I would rather not do in general)
  3. once in PROD!
  4. on every new developer's laptop! (maybe more than once if a developer deletes their database sometimes- which happens often)

Purposes of afterparty tasks:

  1. If data needs to be updated in prod in a way not accomplishable via the UI, afterparty tasks with tests are hugely preferable to me updating data in prod by hand in rails console.
  2. afterparty tasks, just like rails migrations, provide a record of what we did and why
  3. maybe something else that doesn't come to mind right now?

Mechanics of afterparty tasks: heroku runs the Procfile when deploying. the procfile includes a call to afterparty. afterparty writes a record to a table in the database recording which tasks it has run (just like migrations)

Seed is run: rake db:seed rake db:seed:replant

  1. manually on a developer machine to get a little data so viewing the UI locally makes sense
  2. manually on QA so there are convenient accounts to log in with for testing features from newly merged code
  3. manually on staging to produce a whole bunch of data so we can give realistic tours to new users, and also find performance problems
  4. NOT on prod!

Seed is for: Making data like casa orgs, contact types, volunteers, supervisors, casa_admins, and the data they need to use the system realistically (i.e. data which, in prod, an all_casa_admin or a casa_admin would create/import)