diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-20 15:10:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-20 15:10:03 +0300 |
commit | 43b4b3e2d2ddebc0a89b94a8251c162ec5719780 (patch) | |
tree | 8a21146370cfd1b24b25cfcacef53e889746f5aa /db | |
parent | 196ada0844fff7642463fbd08a44609a1e1fa713 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
5 files changed, 76 insertions, 0 deletions
diff --git a/db/migrate/20200318162148_add_external_key_to_issues_table.rb b/db/migrate/20200318162148_add_external_key_to_issues_table.rb new file mode 100644 index 00000000000..eeac6ae3155 --- /dev/null +++ b/db/migrate/20200318162148_add_external_key_to_issues_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddExternalKeyToIssuesTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :issues, :external_key, :string, limit: 255 + end + end + + def down + with_lock_retries do + remove_column :issues, :external_key + end + end +end diff --git a/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb b/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb new file mode 100644 index 00000000000..adca6c3b493 --- /dev/null +++ b/db/migrate/20200318163148_add_index_on_external_key_to_issues_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnExternalKeyToIssuesTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:issues, [:project_id, :external_key], unique: true, where: 'external_key IS NOT NULL') + end + + def down + remove_concurrent_index(:issues, [:project_id, :external_key]) + end +end diff --git a/db/migrate/20200318164448_add_external_key_to_epics_table.rb b/db/migrate/20200318164448_add_external_key_to_epics_table.rb new file mode 100644 index 00000000000..c21fb1698bc --- /dev/null +++ b/db/migrate/20200318164448_add_external_key_to_epics_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddExternalKeyToEpicsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :epics, :external_key, :string, limit: 255 + end + end + + def down + with_lock_retries do + remove_column :epics, :external_key + end + end +end diff --git a/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb b/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb new file mode 100644 index 00000000000..0f3b2dbe3ee --- /dev/null +++ b/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnExternalKeyToEpicsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:epics, [:group_id, :external_key], unique: true, where: 'external_key IS NOT NULL') + end + + def down + remove_concurrent_index(:epics, [:group_id, :external_key]) + end +end diff --git a/db/schema.rb b/db/schema.rb index 2ecc0b9b2d6..74167ad30c4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1606,6 +1606,7 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.integer "start_date_sourcing_epic_id" t.integer "due_date_sourcing_epic_id" t.integer "health_status", limit: 2 + t.string "external_key", limit: 255 t.index "group_id, ((iid)::character varying) varchar_pattern_ops", name: "index_epics_on_group_id_and_iid_varchar_pattern" t.index ["assignee_id"], name: "index_epics_on_assignee_id" t.index ["author_id"], name: "index_epics_on_author_id" @@ -1613,6 +1614,7 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.index ["due_date_sourcing_epic_id"], name: "index_epics_on_due_date_sourcing_epic_id", where: "(due_date_sourcing_epic_id IS NOT NULL)" t.index ["due_date_sourcing_milestone_id"], name: "index_epics_on_due_date_sourcing_milestone_id" t.index ["end_date"], name: "index_epics_on_end_date" + t.index ["group_id", "external_key"], name: "index_epics_on_group_id_and_external_key", unique: true, where: "(external_key IS NOT NULL)" t.index ["group_id"], name: "index_epics_on_group_id" t.index ["iid"], name: "index_epics_on_iid" t.index ["lock_version"], name: "index_epics_on_lock_version", where: "(lock_version IS NULL)" @@ -2222,6 +2224,7 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.integer "duplicated_to_id" t.integer "promoted_to_epic_id" t.integer "health_status", limit: 2 + t.string "external_key", limit: 255 t.index ["author_id", "id", "created_at"], name: "index_issues_on_author_id_and_id_and_created_at" t.index ["author_id"], name: "index_issues_on_author_id" t.index ["closed_by_id"], name: "index_issues_on_closed_by_id" @@ -2233,6 +2236,7 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.index ["moved_to_id"], name: "index_issues_on_moved_to_id", where: "(moved_to_id IS NOT NULL)" t.index ["project_id", "created_at", "id", "state_id"], name: "idx_issues_on_project_id_and_created_at_and_id_and_state_id" t.index ["project_id", "due_date", "id", "state_id"], name: "idx_issues_on_project_id_and_due_date_and_id_and_state_id", where: "(due_date IS NOT NULL)" + t.index ["project_id", "external_key"], name: "index_issues_on_project_id_and_external_key", unique: true, where: "(external_key IS NOT NULL)" t.index ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true t.index ["project_id", "relative_position", "state_id", "id"], name: "idx_issues_on_project_id_and_rel_position_and_state_id_and_id", order: { id: :desc } t.index ["project_id", "updated_at", "id", "state_id"], name: "idx_issues_on_project_id_and_updated_at_and_id_and_state_id" |