Skip to content

Commit d729a6c

Browse files
committed
Don't index repository identifier if doesn't exist
1 parent 4bea0ea commit d729a6c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: db/migrate/20120904060609_update_multi_repo_per_project.rb

+10-4
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ def self.up
3737
end
3838

3939
add_index :projects, [:identifier]
40-
add_index :repositories, [:identifier]
41-
add_index :repositories, [:identifier, :project_id]
40+
begin
41+
add_index :repositories, [:identifier]
42+
add_index :repositories, [:identifier, :project_id]
43+
rescue
44+
end
4245
rename_column :git_caches, :proj_identifier, :repo_identifier
4346

4447
begin
@@ -102,8 +105,11 @@ def self.down
102105
end
103106

104107
remove_index :projects, [:identifier]
105-
remove_index :repositories, [:identifier]
106-
remove_index :repositories, [:identifier, :project_id]
108+
begin
109+
remove_index :repositories, [:identifier]
110+
remove_index :repositories, [:identifier, :project_id]
111+
rescue
112+
end
107113
rename_column :git_caches, :repo_identifier, :proj_identifier
108114

109115
begin

0 commit comments

Comments
 (0)