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>2020-03-13 15:09:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 15:09:22 +0300
commit286fe61013674fe2d245ffc8d2233baf09923e70 (patch)
tree2037291f5863105e54e75be056b49f7d62007cae /db
parent4cb5e5011abfe8d50ac3a7ebd0018c563c6d7af4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb19
-rw-r--r--db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb29
-rw-r--r--db/schema.rb2
3 files changed, 49 insertions, 1 deletions
diff --git a/db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb b/db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb
new file mode 100644
index 00000000000..8005da5fbae
--- /dev/null
+++ b/db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexOnAuthorIdAndIdAndCreatedAtToNotes < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :notes, [:author_id, :created_at]
+ remove_concurrent_index :notes, [:author_id]
+ end
+
+ def down
+ add_concurrent_index :notes, [:author_id]
+ remove_concurrent_index :notes, [:author_id, :created_at]
+ end
+end
diff --git a/db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb b/db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb
new file mode 100644
index 00000000000..d1ed53d8e70
--- /dev/null
+++ b/db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class ScheduleLinkLfsObjectsProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION = 'LinkLfsObjectsProjects'
+ BATCH_SIZE = 1000
+
+ disable_ddl_transaction!
+
+ def up
+ lfs_objects_projects = Gitlab::BackgroundMigration::LinkLfsObjectsProjects::LfsObjectsProject.linkable
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ lfs_objects_projects,
+ MIGRATION,
+ BackgroundMigrationWorker.minimum_interval,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ # No-op. No need to make this reversible. In case the jobs enqueued runs and
+ # fails at some point, some records will be created. When rescheduled, those
+ # records won't be re-created. It's also hard to track which records to clean
+ # up if ever.
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index ca12b77bd2e..0b261a2461d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -2829,7 +2829,7 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do
t.boolean "resolved_by_push"
t.bigint "review_id"
t.boolean "confidential"
- t.index ["author_id"], name: "index_notes_on_author_id"
+ t.index ["author_id", "created_at"], name: "index_notes_on_author_id_and_created_at"
t.index ["commit_id"], name: "index_notes_on_commit_id"
t.index ["created_at"], name: "index_notes_on_created_at"
t.index ["discussion_id"], name: "index_notes_on_discussion_id"