Closed jlvallelonga closed 2 months ago
@krschacht for the production issues, does the if Rails.env.development?
check solve that. I'm not sure I understand your vision for the rake task on this one. We're only trying to load the seed data in dev/test right?
I was just thinking we should make this a rake task, so you and I (and future developers) can more easily populate the database. Maybe just bin/rails db:fixtures
will load all the fixtures in the database.
You'd change this to be within lib/tasks/db/fixtures.rake
And then I don't think you need the environment check since you and I would just execute it deliberately when we want to quickly get some data in there for testing.
I found out that there's actually a built-in rake task for this so I removed the seeds file and added a note to the readme. Loading fixtures can be done with docker compose run base rails db:fixtures:load
@jlvallelonga I can't believe I never knew about this! I spent a bunch of hours implementing and maintaining that old seeds file thing. Sheesh. And I swear I even googled about it because it wasn't easy to manually load fixture data from the seeds file. :) Anyway, TIL ...
A couple small changes then we can merge it in.
following up on conversation here:
https://github.com/AllYourBot/hostedgpt/pull/465#discussion_r1681218434
turns out there's a db:fixtures:load task built-in so just adding a readme item