Hi,
yesterday I updated foreman from 1.7.5 to 1.8 without any problems. Today I
updated from 1.8 to 1.8.1 and got follow error message [1]
How can I repair it? Do you need any additional information?
Gruesse,
thomas.
foreman-rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
[deprecated] I18n.enforce_available_locales will default to true in the
future. If you really want to skip validation of your locale you can set
I18n.enforce_available_locales = false to avoid this message.
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== AddIndexToLogsSourceId: migrating
···
=========================================
-- add_index(:logs, :source_id)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Index name ‘index_logs_on_source_id’ on table ‘logs’ already
exists/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/schema_statements.rb:576:in
add_index_options' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/schema_statements.rb:351:in
add_index’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:466:in
block in method_missing' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:438:in
block in say_with_time’
/usr/lib/ruby/1.9.1/benchmark.rb:280:in measure' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:438:in
say_with_time’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:458:in
method_missing' /usr/share/foreman/db/migrate/20150428070436_add_index_to_logs_source_id.rb:3:in
up’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in
block (2 levels) in migrate' /usr/lib/ruby/1.9.1/benchmark.rb:280:in
measure’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in
block in migrate' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in
with_connection’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:389:in
migrate' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:528:in
migrate’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:720:in
block (2 levels) in migrate' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:777:in
call’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:777:in
ddl_transaction' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:719:in
block in migrate’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in
each' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in
migrate’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:570:in
up' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:551:in
migrate’
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/railties/databases.rake:193:in
block (2 levels) in <top (required)>' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in
call’
/usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in
block in execute' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in
each’
/usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in
execute' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:179:in
block in invoke_with_call_chain’
/usr/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:172:in
invoke_with_call_chain’
/usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:165:in
invoke' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:150:in
invoke_task’
/usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in
block (2 levels) in top_level' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in
each’
/usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in
block in top_level' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:115:in
run_with_threads’
/usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:100:in
top_level' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:78:in
block in run’
/usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in
standard_exception_handling' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in
run’
/usr/bin/rake:27:in `'
Tasks: TOP => db:migrate
Hi,
sry, I sent this question to early.
alter table logs drop index index_logs_on_source_id;
solves this problem, after this statement
foreman-rake db:migrate
runs fine.
sry for the noise,
thomas.
···
Am Donnerstag, 21. Mai 2015 09:44:14 UTC+2 schrieb Thomas Polnik:
>
> Hi,
>
> yesterday I updated foreman from 1.7.5 to 1.8 without any problems. Today
> I updated from 1.8 to 1.8.1 and got follow error message [1]
>
> How can I repair it? Do you need any additional information?
>
> Gruesse,
> thomas.
>
> foreman-rake db:migrate --trace
> ** Invoke db:migrate (first_time)
> ** Invoke environment (first_time)
> ** Execute environment
> [deprecated] I18n.enforce_available_locales will default to true in the
> future. If you really want to skip validation of your locale you can set
> I18n.enforce_available_locales = false to avoid this message.
> ** Invoke db:load_config (first_time)
> ** Execute db:load_config
> ** Execute db:migrate
> == AddIndexToLogsSourceId: migrating
> =========================================
> -- add_index(:logs, :source_id)
> rake aborted!
> StandardError: An error has occurred, all later migrations canceled:
>
> Index name 'index_logs_on_source_id' on table 'logs' already
> exists/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/schema_statements.rb:576:in
> `add_index_options'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/schema_statements.rb:351:in
> `add_index'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:466:in
> `block in method_missing'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:438:in
> `block in say_with_time'
> /usr/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:438:in
> `say_with_time'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:458:in
> `method_missing'
> /usr/share/foreman/db/migrate/20150428070436_add_index_to_logs_source_id.rb:3:in
> `up'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in
> `block (2 levels) in migrate'
> /usr/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in
> `block in migrate'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in
> `with_connection'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:389:in
> `migrate'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:528:in
> `migrate'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:720:in
> `block (2 levels) in migrate'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:777:in
> `call'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:777:in
> `ddl_transaction'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:719:in
> `block in migrate'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in
> `each'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in
> `migrate'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:570:in
> `up'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:551:in
> `migrate'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/railties/databases.rake:193:in
> `block (2 levels) in '
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in
> `call'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in
> `block in execute'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in
> `each'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in
> `execute'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:179:in
> `block in invoke_with_call_chain'
> /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:172:in
> `invoke_with_call_chain'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:165:in
> `invoke'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:150:in
> `invoke_task'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in
> `block (2 levels) in top_level'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in
> `each'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in
> `block in top_level'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:115:in
> `run_with_threads'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:100:in
> `top_level'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:78:in
> `block in run'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in
> `standard_exception_handling'
> /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in
> `run'
> /usr/bin/rake:27:in `'
> Tasks: TOP => db:migrate
>
This suggests you already had the index somehow, perhaps added manually?
You can probably just comment out the add_index in
db/migrate/20150428070436_add_index_to_logs_source_id.rb and re-run it.
···
On 21/05/15 08:44, Thomas Polnik wrote:
> Hi,
>
> yesterday I updated foreman from 1.7.5 to 1.8 without any problems.
> Today I updated from 1.8 to 1.8.1 and got follow error message [1]
>
> How can I repair it? Do you need any additional information?
>
> Gruesse,
> thomas.
>
> foreman-rake db:migrate --trace
> ** Invoke db:migrate (first_time)
> ** Invoke environment (first_time)
> ** Execute environment
> [deprecated] I18n.enforce_available_locales will default to true in the
> future. If you really want to skip validation of your locale you can set
> I18n.enforce_available_locales = false to avoid this message.
> ** Invoke db:load_config (first_time)
> ** Execute db:load_config
> ** Execute db:migrate
> == AddIndexToLogsSourceId: migrating
> =========================================
> -- add_index(:logs, :source_id)
> rake aborted!
> StandardError: An error has occurred, all later migrations canceled:
>
> Index name 'index_logs_on_source_id' on table 'logs' already
> exists
–
Dominic Cleal
Red Hat Engineering