Looks like someone else had the same problem:
http://theforeman.org/issues/1316
Except for me, rerunning the command does not change the error. For fun, I
created the table manually via:
foreman=# CREATE TABLE "media" ("id" serial primary key, "name" character
varying(50) DEFAULT '' NOT NULL, "path" character varying(100) DEFAULT ''
NOT NULL, "operatingsystem_id" integer, "created_at" timestamp,
"updated_at" timestamp) ;
NOTICE: CREATE TABLE will create implicit sequence "media_id_seq" for
serial column "media.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "media_pkey"
for table "media"
CREATE TABLE
Then to skip this migration, added it to the schema_migrations table:
foreman=# INSERT into schema_migrations values('20090717025820');
INSERT 0 1
Then run the migration again, same error but on a different table (ptables):
rake db:migrate --trace
Libvirt binding are missing - hypervisor management is disabled
/Library/Ruby/Gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10:
warning: already initialized constant ENC_NONE
/Library/Ruby/Gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11:
warning: already initialized constant ENC_EUC
/Library/Ruby/Gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12:
warning: already initialized constant ENC_SJIS
/Library/Ruby/Gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13:
warning: already initialized constant ENC_UTF8
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreateDomains: migrating
···
==================================================
-- create_table(:domains)
NOTICE: CREATE TABLE will create implicit sequence "domains_id_seq" for
serial column "domains.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"domains_pkey" for table "domains"
-> 0.0061s
== CreateDomains: migrated (0.0062s)
=========================================
== CreateSubnets: migrating
– create_table(:subnets)
NOTICE: CREATE TABLE will create implicit sequence “subnets_id_seq” for
serial column “subnets.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"subnets_pkey” for table “subnets”
-> 0.0035s
== CreateSubnets: migrated (0.0036s)
== CreateOperatingsystems: migrating
– create_table(:operatingsystems)
NOTICE: CREATE TABLE will create implicit sequence
"operatingsystems_id_seq" for serial column “operatingsystems.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"operatingsystems_pkey” for table “operatingsystems”
-> 0.0025s
== CreateOperatingsystems: migrated (0.0026s)
== CreateModels: migrating
– create_table(:models)
NOTICE: CREATE TABLE will create implicit sequence “models_id_seq” for
serial column “models.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"models_pkey” for table “models”
-> 0.0036s
– add_column(:hosts, :model_id, :integer)
-> 0.0009s
== CreateModels: migrated (0.0047s)
== CreateEnvironments: migrating
– create_table(:environments)
NOTICE: CREATE TABLE will create implicit sequence "environments_id_seq"
for serial column “environments.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"environments_pkey” for table “environments”
-> 0.0028s
– create_table(:environments_puppetclasses, {:id=>false})
-> 0.0009s
== CreateEnvironments: migrated (0.0038s)
== CreateReports: migrating
– create_table(:reports)
NOTICE: CREATE TABLE will create implicit sequence “reports_id_seq” for
serial column “reports.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"reports_pkey” for table “reports”
-> 0.0039s
== CreateReports: migrated (0.0040s)
== CreatePtables: migrating
– create_table(:ptables)
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
: CREATE TABLE “ptables” (“id” serial primary key, “name” character
varying(64) NOT NULL, “layout” character varying(4096) NOT NULL,
“created_at” timestamp, “updated_at” timestamp)
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/postgresql_adapter.rb:518:in
exec' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/postgresql_adapter.rb:518:in
execute’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract_adapter.rb:202:in
log' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.15/lib/active_support/notifications/instrumenter.rb:21:in
instrument’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract_adapter.rb:200:in
log' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/postgresql_adapter.rb:514:in
execute’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:167:in
create_table' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:385:in
send’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:385:in
method_missing' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:361:in
say_with_time’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in
measure' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:361:in
say_with_time’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:381:in
method_missing' /Users/allan/repos/foreman/db/migrate/20090730152224_create_ptables.rb:4:in
up_without_benchmarks’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:314:in
send' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:314:in
migrate’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in
measure' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:314:in
migrate’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:397:in
__send__' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:397:in
migrate’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:539:in
migrate' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:613:in
call’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:613:in
ddl_transaction' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in
transaction’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/transactions.rb:207:in
transaction' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:613:in
ddl_transaction’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:538:in
migrate' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:525:in
each’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:525:in
migrate' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:435:in
up’
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:417:in
migrate' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.15/lib/active_record/railties/databases.rake:151 /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
call’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in execute' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
each’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in execute' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in
invoke_with_call_chain’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in
synchronize' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
invoke_with_call_chain’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in invoke' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
invoke_task’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
top_level' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
each’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
top_level' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in
top_level' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in
run’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in
run’
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:19:in `load’
/usr/bin/rake:19
Tasks: TOP => db:migrate
I’m not sure how to get this migration to succeed, and would love to get
foreman going on postgres instead of going to mysql.
Thanks,
Allan
On Fri, Sep 14, 2012 at 1:05 PM, Allan Feid allanfeid@gmail.com wrote:
From my postgres log:
ERROR: relation “settings” does not exist at character 245
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 = ‘“settings”’::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
ERROR: current transaction is aborted, commands ignored until end of
transaction block
STATEMENT: CREATE TABLE “media” (“id” serial primary key, "name"
character varying(50) DEFAULT ‘’ NOT NULL, “path” character varying(100)
DEFAULT ‘’ NOT NULL, “operatingsystem_id” integer, “created_at” timestamp,
“updated_at” timestamp)
Removing the defaults/nulls/etc does not seem to effect the error
unfortunately.
On Mon, Sep 10, 2012 at 8:02 AM, Ohad Levy ohadlevy@gmail.com wrote:
On Thu, Sep 6, 2012 at 5:51 PM, Allan Feid allanfeid@gmail.com wrote:
Hello,
I am trying to set up a brand new database in postgresql, I left out the
successful migration data, but below is where it appears to fail:
[root@ops-foreman01.ma01 foreman]# RAILS_ENV=development bundle exec
rake db:migrate --trace
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10:
warning: already initialized constant ENC_NONE
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11:
warning: already initialized constant ENC_EUC
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12:
warning: already initialized constant ENC_SJIS
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13:
warning: already initialized constant ENC_UTF8
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreateMedia: migrating
– create_table(:media)
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
: CREATE TABLE “media” (“id” serial primary key, “name” character
varying(50) DEFAULT ‘’ NOT NULL, “path” character varying(100) DEFAULT ‘‘
NOT NULL, “operatingsystem_id” integer, “created_at” timestamp,
“updated_at” timestamp)
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/postgresql_adapter.rb:518:in
exec' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/postgresql_adapter.rb:518:in
execute’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract_adapter.rb:202:in
log' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/notifications/instrumenter.rb:21:in
instrument’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract_adapter.rb:200:in
log' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/postgresql_adapter.rb:514:in
execute’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:167:in
create_table' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:385:in
send’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:385:in
method_missing' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:361:in
say_with_time’
/usr/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:361:in
say_with_time’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:381:in
method_missing' /usr/share/foreman/db/migrate/20090717025820_create_media.rb:4:in
up_without_benchmarks’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:314:in
send' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:314:in
migrate’
/usr/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:314:in
migrate’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:397:in
__send__' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:397:in
migrate’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:539:in
migrate' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:613:in
call’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:613:in
ddl_transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in
transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/transactions.rb:207:in
transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:613:in
ddl_transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:538:in
migrate' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:525:in
each’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:525:in
migrate' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:435:in
up’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/migration.rb:417:in
`migrate’
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/railties/databases.rake:151
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in call' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
execute’
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
execute’
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in
invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in
synchronize’
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in
invoke’
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
invoke_task' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
top_level’
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
each' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
top_level’
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in
top_level’
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in
run' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handli