Technology Musings

December 22, 2015

Platforms / Rails and Updated Postgres not Performing Migrations


Apparently, there was a change to something in postgres 9.5, or maybe just my install of it.  If you upgrade your Postgres database version and suddenly your rails app stops doing migrations, add the following line to config/database.yml database config to get it working again:


  schema_search_path: public

The error message i was getting was:


ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR:  relation "schema_migrations" already exists

Basically, sometimes Rails was finding the schema_migrations table, and sometimes it wasn't, but setting the schema_search_path fixed it.

I'm still not sure where exactly the problem came from, but setting the setting fixed it.