Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
37a4c547
Commit
37a4c547
authored
Apr 09, 2020
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate legacy uploads out of deprecated paths
parent
b2535a90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
db/post_migrate/20200409211607_migrate_legacy_attachments.rb
db/post_migrate/20200409211607_migrate_legacy_attachments.rb
+32
-0
db/structure.sql
db/structure.sql
+1
-0
No files found.
db/post_migrate/20200409211607_migrate_legacy_attachments.rb
0 → 100644
View file @
37a4c547
# frozen_string_literal: true
class
MigrateLegacyAttachments
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
DOWNTIME
=
false
MIGRATION
=
'LegacyUploadsMigrator'
.
freeze
BATCH_SIZE
=
5000
DELAY_INTERVAL
=
5
.
minutes
.
to_i
class
Upload
<
ActiveRecord
::
Base
self
.
table_name
=
'uploads'
include
::
EachBatch
end
def
up
Upload
.
where
(
uploader:
'AttachmentUploader'
,
model_type:
'Note'
).
each_batch
(
of:
BATCH_SIZE
)
do
|
relation
,
index
|
start_id
,
end_id
=
relation
.
pluck
(
'MIN(id), MAX(id)'
).
first
delay
=
index
*
delay_interval
BackgroundMigrationWorker
.
perform_in
(
delay
,
migration
,
[
start_id
,
end_id
])
end
end
def
down
# no-op
end
end
db/structure.sql
View file @
37a4c547
...
...
@@ -13147,5 +13147,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200408110856
20200408153842
20200408175424
20200409211607
\
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment