Hello,
I have followed the upgrade instructions from 1.4.4 to 1.5 and get a
'validation failed' error on the 'foreman-rake db:migrate' task
Can anyone provide a hint on getting past this?
Appreciate your response.
Cheers,
Ben Morrice
Output is below:
[ ~]# foreman-rake -v db:migrate
== CreateCachedUsergroupMembers: migrating
···
=================================== -- create_table(:cached_usergroup_members) NOTICE: CREATE TABLE will create implicit sequence "cached_usergroup_members_id_seq" for serial column "cached_usergroup_members.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "cached_usergroup_members_pkey" for table "cached_usergroup_members" -> 0.0116s -- add_index(:cached_usergroup_members, :user_id) -> 0.0030s -- add_index(:cached_usergroup_members, :usergroup_id) -> 0.0029s rake aborted! An error has occurred, this and all later migrations canceled:Validation failed: Adding would cause a cycle!
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
[ ~]#
Trace is below:
[ ~]# foreman-rake -v db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== CreateCachedUsergroupMembers: migrating
– create_table(:cached_usergroup_members)
NOTICE: CREATE TABLE will create implicit sequence
"cached_usergroup_members_id_seq" for serial column
"cached_usergroup_members.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"cached_usergroup_members_pkey" for table “cached_usergroup_members”
-> 0.0037s
– add_index(:cached_usergroup_members, :user_id)
-> 0.0024s
– add_index(:cached_usergroup_members, :usergroup_id)
-> 0.0019s
rake aborted!
An error has occurred, this and all later migrations canceled:
Validation failed: Adding would cause a cycle!
/usr/share/foreman/lib/core_extensions.rb:90:in detect_cycle' /usr/share/foreman/lib/core_extensions.rb:77:in
ensure’
/usr/share/foreman/app/models/usergroup_member.rb:17:in ensure_no_cycle' /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:418:in
_run__197232453163765864__validation__4138096205087008851__callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
__run_callback' /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
_run_validation_callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
run_callbacks' /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
run_validations!’
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in
valid?' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in
valid?’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:77:in
perform_validations' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:56:in
save!’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:33:in
save!' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in
block in save!’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in
block in with_transaction_returning_status' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in
transaction’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in
transaction' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in
with_transaction_returning_status’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in
save!' /usr/share/foreman/db/migrate/20131122170726_create_cached_usergroup_members.rb:13:in
each’
/usr/share/foreman/db/migrate/20131122170726_create_cached_usergroup_members.rb:13:in
change' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:407:in
block (2 levels) in migrate’
/opt/rh/ruby193/root/usr/share/ruby/benchmark.rb:280:in measure' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:407:in
block in migrate’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in
with_connection' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:389:in
migrate’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:528:in
migrate' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:720:in
block (2 levels) in migrate’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:775:in
call' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:775:in
block in ddl_transaction’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in
transaction' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in
transaction’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:775:in
ddl_transaction' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:719:in
block in migrate’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:700:in
each' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:700:in
migrate’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:570:in
up' /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/migration.rb:551:in
migrate’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:153:in
block (2 levels) in <top (required)>' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in
call’
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in block in execute' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in
each’
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in execute' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:158:in
block in
invoke_with_call_chain’
/opt/rh/ruby193/root/usr/share/ruby/monitor.rb:211:in mon_synchronize' /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:151:in
invoke_with_call_chain’
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:144:in invoke' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:116:in
invoke_task’
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in block (2 levels) in top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in
each’
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in block in top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in
standard_exception_handling’
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:88:in top_level' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:66:in
block in run’
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in
standard_exception_handling' /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in
run’
/opt/rh/ruby193/root/usr/bin/rake:32:in `'
Tasks: TOP => db:migrate
[ ~]#