diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 15:09:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 15:09:13 +0000 |
commit | 736d36d8597d0d1ec1b47644e6d091c3f4a78f45 (patch) | |
tree | a38f6fef2b7147416b31f8294a9389b3bb472c87 /db | |
parent | 5426ca9908085087d465fa52800335f408eb965a (diff) | |
download | gitlab-ce-736d36d8597d0d1ec1b47644e6d091c3f4a78f45.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
4 files changed, 46 insertions, 0 deletions
diff --git a/db/migrate/20200219133859_add_environment_id_to_deployment_merge_requests.rb b/db/migrate/20200219133859_add_environment_id_to_deployment_merge_requests.rb new file mode 100644 index 00000000000..a57d0b44c52 --- /dev/null +++ b/db/migrate/20200219133859_add_environment_id_to_deployment_merge_requests.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddEnvironmentIdToDeploymentMergeRequests < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :deployment_merge_requests, :environment_id, :integer, null: true + end +end diff --git a/db/migrate/20200219141307_add_environment_id_fk_to_deployment_merge_requests.rb b/db/migrate/20200219141307_add_environment_id_fk_to_deployment_merge_requests.rb new file mode 100644 index 00000000000..76980b21feb --- /dev/null +++ b/db/migrate/20200219141307_add_environment_id_fk_to_deployment_merge_requests.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddEnvironmentIdFkToDeploymentMergeRequests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :deployment_merge_requests, :environments, column: :environment_id, on_delete: :cascade + end + + def down + remove_foreign_key_if_exists :deployment_merge_requests, column: :environment_id + end +end diff --git a/db/migrate/20200219142522_add_environment_id_merge_request_id_uniq_idx_to_deployment_merge_requests.rb b/db/migrate/20200219142522_add_environment_id_merge_request_id_uniq_idx_to_deployment_merge_requests.rb new file mode 100644 index 00000000000..a557f3f88d7 --- /dev/null +++ b/db/migrate/20200219142522_add_environment_id_merge_request_id_uniq_idx_to_deployment_merge_requests.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddEnvironmentIdMergeRequestIdUniqIdxToDeploymentMergeRequests < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :deployment_merge_requests, [:environment_id, :merge_request_id], unique: true, name: 'idx_environment_merge_requests_unique_index' + end + + def down + remove_concurrent_index_by_name :deployment_merge_requests, 'idx_environment_merge_requests_unique_index' + end +end diff --git a/db/schema.rb b/db/schema.rb index c6a5e2dd869..149582f94bf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1372,7 +1372,9 @@ ActiveRecord::Schema.define(version: 2020_02_26_162723) do create_table "deployment_merge_requests", id: false, force: :cascade do |t| t.integer "deployment_id", null: false t.integer "merge_request_id", null: false + t.integer "environment_id" t.index ["deployment_id", "merge_request_id"], name: "idx_deployment_merge_requests_unique_index", unique: true + t.index ["environment_id", "merge_request_id"], name: "idx_environment_merge_requests_unique_index", unique: true t.index ["merge_request_id"], name: "index_deployment_merge_requests_on_merge_request_id" end @@ -4719,6 +4721,7 @@ ActiveRecord::Schema.define(version: 2020_02_26_162723) do add_foreign_key "deployment_clusters", "clusters", on_delete: :cascade add_foreign_key "deployment_clusters", "deployments", on_delete: :cascade add_foreign_key "deployment_merge_requests", "deployments", on_delete: :cascade + add_foreign_key "deployment_merge_requests", "environments", name: "fk_a064ff4453", on_delete: :cascade add_foreign_key "deployment_merge_requests", "merge_requests", on_delete: :cascade add_foreign_key "deployments", "clusters", name: "fk_289bba3222", on_delete: :nullify add_foreign_key "deployments", "projects", name: "fk_b9a3851b82", on_delete: :cascade |