Commit 7afdb317 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Remove related_issues and add issue_links table

parent fbdc335d
class CreateRelatedIssuesTable < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
create_table :related_issues do |t|
t.integer :issue_id, null: false, index: true
t.integer :related_issue_id, null: false, index: true
t.timestamps null: true
end
add_index :related_issues, [:issue_id, :related_issue_id], unique: true
add_concurrent_foreign_key :related_issues, :issues, column: :issue_id
add_concurrent_foreign_key :related_issues, :issues, column: :related_issue_id
end
def down
drop_table :related_issues
end
end
class CreateIssueLinksTable < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
create_table :issue_links do |t|
t.integer :source_id, null: false, index: true
t.integer :target_id, null: false, index: true
t.timestamps null: true
end
add_index :issue_links, [:source_id, :target_id], unique: true
add_concurrent_foreign_key :issue_links, :issues, column: :source_id
add_concurrent_foreign_key :issue_links, :issues, column: :target_id
end
def down
drop_table :issue_links
end
end
......@@ -591,6 +591,17 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_index "issue_assignees", ["issue_id", "user_id"], name: "index_issue_assignees_on_issue_id_and_user_id", unique: true, using: :btree
add_index "issue_assignees", ["user_id"], name: "index_issue_assignees_on_user_id", using: :btree
create_table "issue_links", force: :cascade do |t|
t.integer "source_id", null: false
t.integer "target_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "issue_links", ["source_id", "target_id"], name: "index_issue_links_on_source_id_and_target_id", unique: true, using: :btree
add_index "issue_links", ["source_id"], name: "index_issue_links_on_source_id", using: :btree
add_index "issue_links", ["target_id"], name: "index_issue_links_on_target_id", using: :btree
create_table "issue_metrics", force: :cascade do |t|
t.integer "issue_id", null: false
t.datetime "first_mentioned_in_commit_at"
......@@ -1304,17 +1315,6 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_index "redirect_routes", ["path"], name: "index_redirect_routes_on_path_text_pattern_ops", using: :btree, opclasses: {"path"=>"varchar_pattern_ops"}
add_index "redirect_routes", ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree
create_table "related_issues", force: :cascade do |t|
t.integer "issue_id", null: false
t.integer "related_issue_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "related_issues", ["issue_id", "related_issue_id"], name: "index_related_issues_on_issue_id_and_related_issue_id", unique: true, using: :btree
add_index "related_issues", ["issue_id"], name: "index_related_issues_on_issue_id", using: :btree
add_index "related_issues", ["related_issue_id"], name: "index_related_issues_on_related_issue_id", using: :btree
create_table "releases", force: :cascade do |t|
t.string "tag"
t.text "description"
......@@ -1719,6 +1719,8 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_foreign_key "container_repositories", "projects"
add_foreign_key "issue_assignees", "issues", name: "fk_b7d881734a", on_delete: :cascade
add_foreign_key "issue_assignees", "users", name: "fk_5e0c8d9154", on_delete: :cascade
add_foreign_key "issue_links", "issues", column: "source_id", name: "fk_c900194ff2", on_delete: :cascade
add_foreign_key "issue_links", "issues", column: "target_id", name: "fk_e71bb44f1f", on_delete: :cascade
add_foreign_key "issue_metrics", "issues", on_delete: :cascade
add_foreign_key "label_priorities", "labels", on_delete: :cascade
add_foreign_key "label_priorities", "projects", on_delete: :cascade
......@@ -1747,8 +1749,6 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_foreign_key "protected_tag_create_access_levels", "namespaces", column: "group_id"
add_foreign_key "protected_tag_create_access_levels", "protected_tags"
add_foreign_key "protected_tag_create_access_levels", "users"
add_foreign_key "related_issues", "issues", column: "related_issue_id", name: "fk_f89e405611", on_delete: :cascade
add_foreign_key "related_issues", "issues", name: "fk_7bc934491d", on_delete: :cascade
add_foreign_key "remote_mirrors", "projects"
add_foreign_key "subscriptions", "projects", on_delete: :cascade
add_foreign_key "system_note_metadata", "notes", name: "fk_d83a918cb1", on_delete: :cascade
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment