summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-16 11:02:42 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-24 19:39:09 +0200
commitc46a0612706a2570342178fe8f61222034675c38 (patch)
tree15ca39227164c7724c54facbb9f2add8e1c00eb4
parent2a99f18478797c67e0b795d71688bd06153abe5a (diff)
downloadgitlab-ce-c46a0612706a2570342178fe8f61222034675c38.tar.gz
Add uniq db index on project_id+iid
-rw-r--r--db/migrate/20140416074002_add_index_on_iid.rb7
-rw-r--r--db/schema.rb3
2 files changed, 10 insertions, 0 deletions
diff --git a/db/migrate/20140416074002_add_index_on_iid.rb b/db/migrate/20140416074002_add_index_on_iid.rb
new file mode 100644
index 00000000000..cbd09082781
--- /dev/null
+++ b/db/migrate/20140416074002_add_index_on_iid.rb
@@ -0,0 +1,7 @@
+class AddIndexOnIid < ActiveRecord::Migration
+ def change
+ add_index :issues, [:project_id, :iid], unique: true
+ add_index :merge_requests, [:target_project_id, :iid], unique: true
+ add_index :milestones, [:project_id, :iid], unique: true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e53a637af66..17ca752db78 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -93,6 +93,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree
add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree
add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree
+ add_index "issues", ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true, using: :btree
add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree
add_index "issues", ["title"], name: "index_issues_on_title", using: :btree
@@ -143,6 +144,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree
add_index "merge_requests", ["source_project_id"], name: "index_merge_requests_on_source_project_id", using: :btree
add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree
+ add_index "merge_requests", ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true, using: :btree
add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree
create_table "milestones", force: true do |t|
@@ -157,6 +159,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
end
add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree
+ add_index "milestones", ["project_id", "iid"], name: "index_milestones_on_project_id_and_iid", unique: true, using: :btree
add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree
create_table "namespaces", force: true do |t|