diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 12:09:18 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 12:09:18 +0000 |
commit | b7c735c8ac11b8182807070fc6f84f2606e15427 (patch) | |
tree | e74b4d25abb8bbf23546f001dd94515e2840a3a3 /db | |
parent | 221b529789f4090341a825695aeb49b8df6dd11d (diff) | |
download | gitlab-ce-b7c735c8ac11b8182807070fc6f84f2606e15427.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20200409211607_migrate_legacy_attachments.rb | 30 | ||||
-rw-r--r-- | db/structure.sql | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/db/post_migrate/20200409211607_migrate_legacy_attachments.rb b/db/post_migrate/20200409211607_migrate_legacy_attachments.rb new file mode 100644 index 00000000000..fb4a996d3b7 --- /dev/null +++ b/db/post_migrate/20200409211607_migrate_legacy_attachments.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class MigrateLegacyAttachments < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + DOWNTIME = false + + MIGRATION = 'LegacyUploadsMigrator' + BATCH_SIZE = 5000 + INTERVAL = 5.minutes.to_i + + class Upload < ActiveRecord::Base + self.table_name = 'uploads' + + include ::EachBatch + end + + def up + queue_background_migration_jobs_by_range_at_intervals(Upload.where(uploader: 'AttachmentUploader', model_type: 'Note'), + MIGRATION, + INTERVAL, + batch_size: BATCH_SIZE) + end + + def down + # no-op + end +end diff --git a/db/structure.sql b/db/structure.sql index d1fdcc9e465..28b0010eb30 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -13152,5 +13152,6 @@ COPY "schema_migrations" (version) FROM STDIN; 20200408110856 20200408153842 20200408175424 +20200409211607 \. |