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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
41412fec
Commit
41412fec
authored
Nov 08, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid instantiating an AR object and ignore dupes
parent
36611773
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
lib/gitlab/background_migration/prepare_unhashed_uploads.rb
lib/gitlab/background_migration/prepare_unhashed_uploads.rb
+15
-1
No files found.
lib/gitlab/background_migration/prepare_unhashed_uploads.rb
View file @
41412fec
...
...
@@ -75,10 +75,24 @@ module Gitlab
def
insert_file_paths
(
file_paths
)
file_paths
.
each
do
|
file_path
|
UnhashedUploadFile
.
create!
(
path:
file_path
)
insert_file_path
(
file_path
)
end
end
def
insert_file_path
(
file_path
)
table_columns_and_values
=
'unhashed_upload_files (path, created_at, updated_at) VALUES (?, ?, ?)'
sql
=
if
Gitlab
::
Database
.
postgresql?
"INSERT INTO
#{
table_columns_and_values
}
ON CONFLICT DO NOTHING;"
else
"INSERT IGNORE INTO
#{
table_columns_and_values
}
;"
end
timestamp
=
Time
.
now
.
utc
.
iso8601
sql
=
ActiveRecord
::
Base
.
send
(
:sanitize_sql_array
,
[
sql
,
file_path
,
timestamp
,
timestamp
])
ActiveRecord
::
Base
.
connection
.
execute
(
sql
)
end
def
schedule_populate_untracked_uploads_jobs
bulk_queue_background_migration_jobs_by_range
(
UnhashedUploadFile
,
FOLLOW_UP_MIGRATION
)
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