Actions
Bug #2083
closedDB migration fails with Postgres in 038125b323
Description
Running from the develop branch (currently on 038125b323 after not having updated for two months) I get the following errors when running RAILS_ENV=production bundle exec rake db:migrate
:
== CreateNics: migrating ===================================================== -- create_table(:nics) NOTICE: CREATE TABLE will create implicit sequence "nics_id_seq" for serial column "nics.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "nics_pkey" for table "nics" -> 0.0741s -- add_index(:nics, [:type], {:name=>"index_by_type"}) -> 0.0419s -- add_index(:nics, [:host_id], {:name=>"index_by_host"}) -> 0.0240s -- add_index(:nics, [:type, :id], {:name=>"index_by_type_and_id"}) -> 0.0240s -- failed to import nics for kvmhost04.mgmt.rz01.riseops.at : PG::Error: ERROR: current transaction is aborted, commands ignored until end of transaction block : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"hosts"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum -- failed to import nics for kvmhost07.mgmt.rz01.riseops.at : PG::Error: ERROR: current transaction is aborted, commands ignored until end of transaction block : SELECT 1 FROM "nics" WHERE ("nics"."mac" = '00:22:19:98:c5:98') LIMIT 1 -- failed to import nics for kvmhost06.mgmt.rz01.riseops.at : PG::Error: ERROR: current transaction is aborted, commands ignored until end of transaction block : SELECT 1 FROM "nics" WHERE ("nics"."mac" = '00:22:19:98:bf:e7') LIMIT 1 -- failed to import nics for kvmhost05.mgmt.rz01.riseops.at : PG::Error: ERROR: current transaction is aborted, commands ignored until end of transaction block : SELECT 1 FROM "nics" WHERE ("nics"."mac" = 'bc:30:5b:e5:91:dd') LIMIT 1 -- remove_columns(:hosts, :sp_mac, :sp_ip, :sp_name, :sp_subnet_id) 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 : ALTER TABLE "hosts" DROP "sp_mac" Tasks: TOP => db:migrate (See full trace by running task with --trace)
Here is the relevant portion of the Postgres server log:
2012-12-31 19:44:49 CET ERROR: relation "locations_organizations" does not exist at character 580 2012-12-31 19:44:49 CET STATEMENT: SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"locations_organizations"'::regclass 2012-12-31 19:44:49 CET ERROR: current transaction is aborted, commands ignored until end of transaction block 2012-12-31 19:44:49 CET STATEMENT: SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_namespace name, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '"locations_organizations"'::regclass 2012-12-31 19:44:49 CET ERROR: current transaction is aborted, commands ignored until end of transaction block 2012-12-31 19:44:49 CET STATEMENT: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"hosts"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum 2012-12-31 19:44:49 CET ERROR: current transaction is aborted, commands ignored until end of transaction block 2012-12-31 19:44:49 CET STATEMENT: SELECT 1 FROM "nics" WHERE ("nics"."mac" = '00:22:19:98:c5:98') LIMIT 1 2012-12-31 19:44:49 CET ERROR: current transaction is aborted, commands ignored until end of transaction block 2012-12-31 19:44:49 CET STATEMENT: SELECT 1 FROM "nics" WHERE ("nics"."mac" = '00:22:19:98:bf:e7') LIMIT 1 2012-12-31 19:44:49 CET ERROR: current transaction is aborted, commands ignored until end of transaction block 2012-12-31 19:44:49 CET STATEMENT: SELECT 1 FROM "nics" WHERE ("nics"."mac" = 'bc:30:5b:e5:91:dd') LIMIT 1 2012-12-31 19:44:49 CET ERROR: current transaction is aborted, commands ignored until end of transaction block 2012-12-31 19:44:49 CET STATEMENT: ALTER TABLE "hosts" DROP "sp_mac"
I am not even sure where exactly the first error occurs that causes the subsequent failures. If there is anything else I can provide, please do tell.
Files
Actions