Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 06:08:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 06:08:02 +0300
commited73d4f207ef6cb8646719baa1188d096c9f3139 (patch)
treedea7ab9906154c73204a0361163e30500f929d44 /db
parent2349eabc1a473bfb70555f0ce6d3d808cecb181d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20191204070713_change_updated_at_index_and_add_index_to_id_on_deployments.rb29
-rw-r--r--db/schema.rb5
2 files changed, 32 insertions, 2 deletions
diff --git a/db/migrate/20191204070713_change_updated_at_index_and_add_index_to_id_on_deployments.rb b/db/migrate/20191204070713_change_updated_at_index_and_add_index_to_id_on_deployments.rb
new file mode 100644
index 00000000000..450b276e689
--- /dev/null
+++ b/db/migrate/20191204070713_change_updated_at_index_and_add_index_to_id_on_deployments.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class ChangeUpdatedAtIndexAndAddIndexToIdOnDeployments < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+
+ PROJECT_ID_INDEX_PARAMS = [[:project_id, :id], order: { id: :desc }]
+ OLD_UPDATED_AT_INDEX_PARAMS = [[:project_id, :updated_at]]
+ NEW_UPDATED_AT_INDEX_PARAMS = [[:project_id, :updated_at, :id], order: { updated_at: :desc, id: :desc }]
+
+ def up
+ add_concurrent_index :deployments, *NEW_UPDATED_AT_INDEX_PARAMS
+
+ remove_concurrent_index :deployments, *OLD_UPDATED_AT_INDEX_PARAMS
+
+ add_concurrent_index :deployments, *PROJECT_ID_INDEX_PARAMS
+ end
+
+ def down
+ add_concurrent_index :deployments, *OLD_UPDATED_AT_INDEX_PARAMS
+
+ remove_concurrent_index :deployments, *NEW_UPDATED_AT_INDEX_PARAMS
+
+ remove_concurrent_index :deployments, *PROJECT_ID_INDEX_PARAMS
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index d33060f0e37..d0b4629d191 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_12_02_031812) do
+ActiveRecord::Schema.define(version: 2019_12_04_070713) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -1339,10 +1339,11 @@ ActiveRecord::Schema.define(version: 2019_12_02_031812) do
t.index ["environment_id", "iid", "project_id"], name: "index_deployments_on_environment_id_and_iid_and_project_id"
t.index ["environment_id", "status"], name: "index_deployments_on_environment_id_and_status"
t.index ["id"], name: "partial_index_deployments_for_legacy_successful_deployments", where: "((finished_at IS NULL) AND (status = 2))"
+ t.index ["project_id", "id"], name: "index_deployments_on_project_id_and_id", order: { id: :desc }
t.index ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true
t.index ["project_id", "status", "created_at"], name: "index_deployments_on_project_id_and_status_and_created_at"
t.index ["project_id", "status"], name: "index_deployments_on_project_id_and_status"
- t.index ["project_id", "updated_at"], name: "index_deployments_on_project_id_and_updated_at"
+ t.index ["project_id", "updated_at", "id"], name: "index_deployments_on_project_id_and_updated_at_and_id", order: { updated_at: :desc, id: :desc }
end
create_table "description_versions", force: :cascade do |t|