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>2021-12-03 21:11:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-03 21:11:11 +0300
commit5b0916450cebb6a88bd651fd0579737541c355c8 (patch)
tree3a788fd8e2ef18b1c6e06d222e84bb5d84307870 /db
parent78aaabb87f180e93fa53aba407a0eef1e12a7a56 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20211125120444_add_index_todos_project_id_user_id.rb15
-rw-r--r--db/post_migrate/20211202145237_add_todos_project_and_id_index.rb32
-rw-r--r--db/schema_migrations/202111251204441
-rw-r--r--db/schema_migrations/202112021452371
-rw-r--r--db/structure.sql4
5 files changed, 52 insertions, 1 deletions
diff --git a/db/post_migrate/20211125120444_add_index_todos_project_id_user_id.rb b/db/post_migrate/20211125120444_add_index_todos_project_id_user_id.rb
new file mode 100644
index 00000000000..5cc78fc75c4
--- /dev/null
+++ b/db/post_migrate/20211125120444_add_index_todos_project_id_user_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexTodosProjectIdUserId < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_todos_on_project_id_and_user_id_and_id'
+
+ def up
+ add_concurrent_index :todos, [:project_id, :user_id, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :todos, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20211202145237_add_todos_project_and_id_index.rb b/db/post_migrate/20211202145237_add_todos_project_and_id_index.rb
new file mode 100644
index 00000000000..69f7822c057
--- /dev/null
+++ b/db/post_migrate/20211202145237_add_todos_project_and_id_index.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddTodosProjectAndIdIndex < Gitlab::Database::Migration[1.0]
+ # When using the methods "add_concurrent_index" or "remove_concurrent_index"
+ # you must disable the use of transactions
+ # as these methods can not run in an existing transaction.
+ # When using "add_concurrent_index" or "remove_concurrent_index" methods make sure
+ # that either of them is the _only_ method called in the migration,
+ # any other changes should go in a separate migration.
+ # This ensures that upon failure _only_ the index creation or removing fails
+ # and can be retried or reverted easily.
+ #
+ # To disable transactions uncomment the following line and remove these
+ # comments:
+ disable_ddl_transaction!
+
+ NEW_INDEX_NAME = 'index_todos_on_project_id_and_id'
+ OLD_INDEX_NAME = 'index_todos_on_project_id'
+
+ def up
+ add_concurrent_index :todos, [:project_id, :id], name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name :todos, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :todos, :project_id, name: OLD_INDEX_NAME
+ remove_concurrent_index_by_name :todos, NEW_INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20211125120444 b/db/schema_migrations/20211125120444
new file mode 100644
index 00000000000..8dca57e74ef
--- /dev/null
+++ b/db/schema_migrations/20211125120444
@@ -0,0 +1 @@
+19062282d022e5d93cd525cff44c67f1fbc5557f1201e523a57725dc0b6ecd70 \ No newline at end of file
diff --git a/db/schema_migrations/20211202145237 b/db/schema_migrations/20211202145237
new file mode 100644
index 00000000000..f5b91a189c8
--- /dev/null
+++ b/db/schema_migrations/20211202145237
@@ -0,0 +1 @@
+d109142aa838faedcd307f6cd235c969ca265813493eef50d63cbc2fe5d203b3 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index cd081495e34..444ff934706 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -27543,7 +27543,9 @@ CREATE INDEX index_todos_on_group_id ON todos USING btree (group_id);
CREATE INDEX index_todos_on_note_id ON todos USING btree (note_id);
-CREATE INDEX index_todos_on_project_id ON todos USING btree (project_id);
+CREATE INDEX index_todos_on_project_id_and_id ON todos USING btree (project_id, id);
+
+CREATE INDEX index_todos_on_project_id_and_user_id_and_id ON todos USING btree (project_id, user_id, id);
CREATE INDEX index_todos_on_target_type_and_target_id ON todos USING btree (target_type, target_id);