

Ask HN: How do you populate a DB to demo your MVC project? - jMyles

So, you need to demo (or QA) a version of your Django &#x2F; Rails project.  You run the test suite; all is good.  You promote to your candidate branch and deploy on your staging server.<p>Now, do you:<p>* Load a bunch of fixtures?<p>* Use Factory Boy &#x2F; Factory Girl (and if so, where is the code that makes it go?)?<p>* Grab data from your production DB (and if so, how?)?<p>* Create model instances manually as you go?<p>* Some other way?<p>It seems clear to me that fixtures are no longer the way.  If the migration pace is anything but very slow, fixtures become the pain point of staging.  Am I correct here?<p>My typical approach of late has been factory boy &#x2F; girl, but this increases the amount of code to test and maintain quite substantially.  Is there a better way?
======
professorplumb
What we do is to back up the staging DB, overwrite it with the current
production DB, then run the necessary migrations on stage to get the schema
up-to-date.

This has a couple of side benefits:

\- "Dry" run of the migrations you'll eventually need to run in production
anyway

\- Using real production data in staging/QA (as long as you're allowed to) can
uncover some edge cases you wouldn't have accounted for using fixtures or
manual prepopulation.

