summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-27 15:07:59 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-27 15:07:59 +0000
commit71c5863d7b1ca9836a7d7703f35750cd726a9846 (patch)
treef6d74be15157d527ffc648212df141293a36a330 /db
parent39fa7d1eeb2dba52f0601128f3ac91f57d19866e (diff)
downloadgitlab-ce-71c5863d7b1ca9836a7d7703f35750cd726a9846.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200215222507_drop_forked_project_links_fk.rb4
-rw-r--r--db/migrate/20200304085423_add_user_type.rb2
-rw-r--r--db/migrate/20200325183636_add_api_index_for_internal_projects.rb21
-rw-r--r--db/structure.sql3
4 files changed, 28 insertions, 2 deletions
diff --git a/db/migrate/20200215222507_drop_forked_project_links_fk.rb b/db/migrate/20200215222507_drop_forked_project_links_fk.rb
index f3ee36e9037..0be7a57ed0e 100644
--- a/db/migrate/20200215222507_drop_forked_project_links_fk.rb
+++ b/db/migrate/20200215222507_drop_forked_project_links_fk.rb
@@ -8,17 +8,21 @@ class DropForkedProjectLinksFk < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
+ # rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction
with_lock_retries do
remove_foreign_key_if_exists :forked_project_links, column: :forked_to_project_id
end
+ # rubocop: enable Migration/WithLockRetriesWithoutDdlTransaction
end
def down
unless foreign_key_exists?(:forked_project_links, :projects, column: :forked_to_project_id)
+ # rubocop: disable Migration/WithLockRetriesWithoutDdlTransaction
with_lock_retries do
# rubocop: disable Migration/AddConcurrentForeignKey
add_foreign_key :forked_project_links, :projects, column: :forked_to_project_id, on_delete: :cascade, validate: false
end
+ # rubocop: enable Migration/WithLockRetriesWithoutDdlTransaction
end
fk_name = concurrent_foreign_key_name(:forked_project_links, :forked_to_project_id, prefix: 'fk_rails_')
diff --git a/db/migrate/20200304085423_add_user_type.rb b/db/migrate/20200304085423_add_user_type.rb
index 68db44c6847..355a16897f4 100644
--- a/db/migrate/20200304085423_add_user_type.rb
+++ b/db/migrate/20200304085423_add_user_type.rb
@@ -5,8 +5,6 @@ class AddUserType < ActiveRecord::Migration[6.0]
DOWNTIME = false
- disable_ddl_transaction!
-
def up
with_lock_retries do
add_column :users, :user_type, :integer, limit: 2
diff --git a/db/migrate/20200325183636_add_api_index_for_internal_projects.rb b/db/migrate/20200325183636_add_api_index_for_internal_projects.rb
new file mode 100644
index 00000000000..ce47f1f3ded
--- /dev/null
+++ b/db/migrate/20200325183636_add_api_index_for_internal_projects.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddApiIndexForInternalProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INTERNAL_PROJECTS_INDEX_NAME = "index_projects_api_created_at_id_for_vis10"
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :projects, [:created_at, :id],
+ where: "visibility_level = 10 AND pending_delete = false",
+ name: INTERNAL_PROJECTS_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :projects, INTERNAL_PROJECTS_INDEX_NAME
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index a972ef7085a..7c6c883196c 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -9685,6 +9685,8 @@ CREATE INDEX index_projects_api_created_at_id_for_archived ON public.projects US
CREATE INDEX index_projects_api_created_at_id_for_archived_vis20 ON public.projects USING btree (created_at, id) WHERE ((archived = true) AND (visibility_level = 20) AND (pending_delete = false));
+CREATE INDEX index_projects_api_created_at_id_for_vis10 ON public.projects USING btree (created_at, id) WHERE ((visibility_level = 10) AND (pending_delete = false));
+
CREATE INDEX index_projects_api_last_activity_at_id_desc ON public.projects USING btree (last_activity_at, id DESC);
CREATE INDEX index_projects_api_name_id_desc ON public.projects USING btree (name, id DESC);
@@ -12839,5 +12841,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200323134519
20200324115359
20200325160952
+20200325183636
\.