[openstreetmap/openstreetmap-website] Add seed data for users, diary entries and iD (#3030)
Andy Allan
notifications at github.com
Wed Jan 6 17:56:35 UTC 2021
We should have a way to separate out two concepts:
* The first is seed data, as defined in most of the documentation that I can find, meaning data that you will want in the database on any/all deployments. The usual example is a list of states or countries, and in our context that would include the languages table I guess. I would maybe put an iD editor registration in there, but not development data.
* The second is "development data", like this PR covers. The kind of stuff that shouldn't appear in a production database. I'm wary of putting this in seeds.rb without at least an `environment` guard.
For the development data, I would like to see this myself! Adding stuff to an empty database is no fun for new developers. But:
* It should be idempotent. When you add the next thing (e.g. traces) and I re-run it, I don't want to see more and more diary entries every time I run the script.
* I would consider using FactoryBot to generate the data, as we use for the tests, along with something like Faker to generate the boilerplate.
* We should consider making this a separate rake task, to isolate it from the db:seed functionality entirely.
I wrote all that, and then I found these posts which probably explain it better than me!
* https://medium.com/@henrytabimagiraldo_41792/stop-using-the-seed-file-to-populate-your-dev-data-in-rails-bb241130c7da
* https://thoughtbot.com/blog/priming-the-pump
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3030#issuecomment-755458958
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210106/7cebe888/attachment-0001.htm>
More information about the rails-dev
mailing list