Travis CI “rake db:migrate” or “rake db:test:prepare” causes rake aborted! PG::Error: ERROR: relation “settings” does not exist
-
24-06-2021 - |
Question
The relevant travis-ci build is at: http://travis-ci.org/#!/NZOI/nztrain/builds/2046207
At that point neither db:migrate or db:test:prepare commands work. I have checked that the db/schema.rb file is there, so it should just be able to load the schema into the database.
Github code also available from https://github.com/NZOI/nztrain/tree/a710ef72089ae589a53a7ca0187f73e7f9bf4cc0
La solution
Error caused by:
- rake db:??? runs initializers
- initializer accessed a table, pulling settings stored in the database table called "settings"
- travis-ci starts without any tables in db
Because initializers run before db:?? has a change to create the tables, error occurs
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow