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
258d253d
Commit
258d253d
authored
Apr 09, 2020
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove rake task to migrate all legacy attachments
parent
37a4c547
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
53 deletions
+6
-53
db/post_migrate/20200409211607_migrate_legacy_attachments.rb
db/post_migrate/20200409211607_migrate_legacy_attachments.rb
+6
-8
doc/administration/raketasks/uploads/migrate.md
doc/administration/raketasks/uploads/migrate.md
+0
-18
lib/tasks/gitlab/uploads/legacy.rake
lib/tasks/gitlab/uploads/legacy.rake
+0
-27
No files found.
db/post_migrate/20200409211607_migrate_legacy_attachments.rb
View file @
258d253d
...
...
@@ -7,9 +7,9 @@ class MigrateLegacyAttachments < ActiveRecord::Migration[6.0]
DOWNTIME
=
false
MIGRATION
=
'LegacyUploadsMigrator'
.
freeze
MIGRATION
=
'LegacyUploadsMigrator'
BATCH_SIZE
=
5000
DELAY_
INTERVAL
=
5
.
minutes
.
to_i
INTERVAL
=
5
.
minutes
.
to_i
class
Upload
<
ActiveRecord
::
Base
self
.
table_name
=
'uploads'
...
...
@@ -18,12 +18,10 @@ class MigrateLegacyAttachments < ActiveRecord::Migration[6.0]
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
queue_background_migration_jobs_by_range_at_intervals
(
Upload
.
where
(
uploader:
'AttachmentUploader'
,
model_type:
'Note'
),
MIGRATION
,
INTERVAL
,
batch_size:
BATCH_SIZE
)
end
def
down
...
...
doc/administration/raketasks/uploads/migrate.md
View file @
258d253d
...
...
@@ -111,24 +111,6 @@ sudo -u git -H bundle exec rake "gitlab:uploads:migrate[FileUploader, MergeReque
sudo
-u
git
-H
bundle
exec
rake
"gitlab:uploads:migrate[DesignManagement::DesignV432x230Uploader, DesignManagement::Action]"
```
## Migrate legacy uploads out of deprecated paths
> Introduced in GitLab 12.3.
To migrate all uploads created by legacy uploaders, run:
**Omnibus Installation**
```
shell
gitlab-rake gitlab:uploads:legacy:migrate
```
**Source Installation**
```
shell
bundle
exec
rake gitlab:uploads:legacy:migrate
```
## Migrate from object storage to local storage
If you need to disable Object Storage for any reason, first you need to migrate
...
...
lib/tasks/gitlab/uploads/legacy.rake
deleted
100644 → 0
View file @
37a4c547
# frozen_string_literal: true
namespace
:gitlab
do
namespace
:uploads
do
namespace
:legacy
do
desc
"GitLab | Uploads | Migrate all legacy attachments"
task
migrate: :environment
do
class
Upload
<
ApplicationRecord
self
.
table_name
=
'uploads'
include
::
EachBatch
end
migration
=
'LegacyUploadsMigrator'
batch_size
=
5000
delay_interval
=
5
.
minutes
.
to_i
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
end
end
end
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