Actions
Bug #8366
closedUpgrade from 1.6.2 to 1.7rc1 fails during AddUniqueIndexToParameter db migration with duplicate key error
Description
Upgrading our Foreman instance from 1.6.2 to 1.7rc1 fails during migration of the DB with the following error:
== AddUniqueIndexToParameter: migrating ====================================== -- add_index(:parameters, [:reference_id, :name], {:unique=>true}) rake aborted! StandardError: An error has occurred, all later migrations canceled: Mysql2::Error: Duplicate entry '4-lag-members' for key 'index_parameters_on_reference_id_and_name': CREATE UNIQUE INDEX `index_parameters_on_reference_id_and_name` ON `parameters` (`reference_id`, `name`)/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.20/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query' (etc...)
This is caused by 20140805114754_add_unique_index_to_parameter.rb
trying to add the mentioned index. However, in my db, I have:
id name ref_id type 1 lag-members 4 GroupParameter 3 lag-members 4 HostParameter
Which leads to the SQL violation.
So it looks like anyone upgrading who has the same parameter set on both Group and Host might suffer this problem?
Updated by Dominic Cleal about 10 years ago
- Related to Bug #6695: Adding two OS parameters with same name doesn't raise any error when values are different added
Updated by Dominic Cleal about 10 years ago
- Target version set to 1.7.2
Looks like the 'type' should be part of the index, thanks for the report!
Updated by Ori Rabin about 10 years ago
- Status changed from New to Assigned
- Assignee set to Ori Rabin
Updated by The Foreman Bot about 10 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/1927 added
- Pull request deleted (
)
Updated by Dominic Cleal about 10 years ago
- Assignee changed from Ori Rabin to Dominic Cleal
Sorry Ori, I thought I'd set assignee but it didn't happen. PR's up if you'd like to review it. If you have another solution, we can compare answers!
Updated by Dominic Cleal about 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset d5f92b39de44658f2c73ff87139f7152e6e41208.
Updated by Dominic Cleal almost 10 years ago
- Translation missing: en.field_release changed from 21 to 30
Actions