Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[api] fix unique index of product_media and update pool repos
allow multiple definitions using arch filter of same repo Conflicts: src/api/db/structure.sql
- Loading branch information
1 parent
1e2f4e0
commit aed588f
Showing
2 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/api/db/migrate/20141110105426_fix_product_media_uniq_index.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class FixProductMediaUniqIndex < ActiveRecord::Migration | ||
def self.up | ||
remove_index :product_media, unique: true, :name => "index_unique" | ||
remove_index :product_update_repositories, unique: true, :name => "index_unique" | ||
|
||
add_index :product_media, [:product_id, :repository_id, :name, :arch_filter_id], unique: true, :name => "index_unique" | ||
add_index :product_update_repositories, [:product_id, :repository_id, :arch_filter_id], unique: true, :name => "index_unique" | ||
end | ||
|
||
def self.down | ||
remove_index :product_media, unique: true, :name => "index_unique" | ||
remove_index :product_update_repositories, unique: true, :name => "index_unique" | ||
|
||
add_index :product_media, [:product_id, :repository_id, :name], unique: true, :name => "index_unique" | ||
add_index :product_update_repositories, [:product_id, :repository_id], unique: true, :name => "index_unique" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters