Closed twothreenine closed 7 months ago
yeah I can reproduce this error. Look's like that the FinancialTransactionClass
is already created somewhere else and then this fails in the seed as the key/name is already taken
It seems that rake db:schema:load
is not intended to always succeed for existing dbs - see discussion here:
https://github.com/rails/rails/issues/41491
Since rake foodsoft:setup_development_docker
already ran rake db:setup
(which includes schema loading and minimal seeding) it cannot be run again without first emptying the db.
ah okay, so we could either try to rewrite the seeds to check whether these initial records already exists (find_or_create_by
doesn't work with the uniqueness constraint somehow rails#36027, but first_or_create
worked for me) or we add a note to the docs that you'd have to recreate a plain database first before loading seeds
or we add a note to the docs that you'd have to recreate a plain database first before loading seeds
Seems like the easiest path, however...:
rake db:drop db:create db:schema:load db:seed:small.en
fails as db:create
doesn't work in our current docker setup (the connection string includes the development
db). So the user would always have a manual step here.
So maybe your other approach would be the easiest way to fix it.
When I try to set Foodsoft up for development via Docker and run
I get
This can be solved by:
http://localhost:2080
(phpMyAdmin) and deleting all tables (development -> select all tables -> delete)active_storage_blobs
couldn't be deleted (similar error as above), trying again to delete all tables succeeds ... and then I forgot how we solved it