postgresql migrations are currently failing
Currently both myself and Lukas are seeing failures on Postgresql, which look like this:
== AddSuseTemplates: migrating =============================================== -- Failed to migrate PG::Error: ERROR: column "operatingsystem_id" of relation "media" does not exist LINE 1: INSERT INTO "media" ("created_at", "name", "operatingsystem_... ^ : INSERT INTO "media" ("created_at", "name", "operatingsystem_id", "path", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" == AddSuseTemplates: migrated (0.2182s) ====================================== rake aborted! An error has occurred, this and all later migrations canceled: PG::Error: ERROR: current transaction is aborted, commands ignored until end of transaction block : SELECT attr.attname FROM pg_attribute attr INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey WHERE cons.contype = 'p' AND cons.conrelid = '"schema_migrations"'::regclass /tmp/foreman/vendorgems/ruby/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1161:in `async_exec'
Git bisecting shows the Rails 3.2 commit is at fault, so I'm not sure how Jenkins is passing tests at the moment. I can't track down what's causing it - the Suse Migration in the error is quite complex, so I assume it relied on something Rails 3.0 specific...
#1 Updated by Ohad Levy about 6 years ago
I blame this line:
Originally I had no idea why this change was required, but according to @Amos, this fixed another failure in pg.
can you try reverting that and see if it solves the issue?
#3 Updated by Dominic Cleal about 6 years ago
- Status changed from New to Ready For Testing
Even if you were a SQLite user, you'd see a log message due to the rescue block in this migration as AR was still thinking that the operatingsystem_id field was present in the media table. For some reason, PostgreSQL wasn't hitting the rescue block (maybe the error was thrown in a transaction commit?).
I think the reason this didn't occur on Jenkins was some change in behaviour when under the test environment. I don't see AR "create" calls happening in migrations (could this be a Rails optimisation as fixtures are used instead?), so the line causing the problem never caused an INSERT statement. I think I'll change Jenkins to migrate in the development environment and then we'll rely on schema loading for test.