From 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 17 Sep 2019 14:16:34 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- ...0_modify_concurrent_index_to_builds_metadata.rb | 23 ++++++++++++++++++++++ db/schema.rb | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb (limited to 'db') diff --git a/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb b/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb new file mode 100644 index 00000000000..ad8979045e5 --- /dev/null +++ b/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class ModifyConcurrentIndexToBuildsMetadata < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_builds_metadata, [:build_id], + where: "interruptible = true", + name: "index_ci_builds_metadata_on_build_id_and_interruptible" + remove_concurrent_index_by_name(:ci_builds_metadata, 'index_ci_builds_metadata_on_build_id_and_interruptible_false') + end + + def down + remove_concurrent_index_by_name(:ci_builds_metadata, 'index_ci_builds_metadata_on_build_id_and_interruptible') + add_concurrent_index :ci_builds_metadata, [:build_id], + where: "interruptible = false", + name: "index_ci_builds_metadata_on_build_id_and_interruptible_false" + end +end diff --git a/db/schema.rb b/db/schema.rb index 8310d15fa9a..b821951180a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_09_12_061145) do +ActiveRecord::Schema.define(version: 2019_09_14_223900) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" @@ -648,7 +648,7 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do t.jsonb "config_options" t.jsonb "config_variables" t.index ["build_id"], name: "index_ci_builds_metadata_on_build_id", unique: true - t.index ["build_id"], name: "index_ci_builds_metadata_on_build_id_and_interruptible_false", where: "(interruptible = false)" + t.index ["build_id"], name: "index_ci_builds_metadata_on_build_id_and_interruptible", where: "(interruptible = true)" t.index ["project_id"], name: "index_ci_builds_metadata_on_project_id" end -- cgit v1.2.1