AllYourBot / hostedgpt

An open version of ChatGPT you can host anywhere or run locally.
MIT License
362 stars 199 forks source link

Add note about db:fixtures:load to README #466

Closed jlvallelonga closed 2 months ago

jlvallelonga commented 3 months ago

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

jlvallelonga commented 3 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?

krschacht commented 2 months ago

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.

jlvallelonga commented 2 months ago

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

krschacht commented 2 months ago

@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.