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
c6bc992b
Commit
c6bc992b
authored
May 18, 2020
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore existing Database.bulk_insert usages
Database.bulk_insert has been deprecated.
parent
b228984d
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
30 additions
and
30 deletions
+30
-30
app/models/design_management/version.rb
app/models/design_management/version.rb
+1
-1
app/models/merge_request_context_commit.rb
app/models/merge_request_context_commit.rb
+1
-1
app/models/merge_request_context_commit_diff_file.rb
app/models/merge_request_context_commit_diff_file.rb
+1
-1
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+2
-2
app/models/merge_request_diff_commit.rb
app/models/merge_request_diff_commit.rb
+1
-1
app/services/ci/extract_sections_from_build_trace_service.rb
app/services/ci/extract_sections_from_build_trace_service.rb
+1
-1
app/services/issuable/clone/attributes_rewriter.rb
app/services/issuable/clone/attributes_rewriter.rb
+1
-1
app/services/projects/detect_repository_languages_service.rb
app/services/projects/detect_repository_languages_service.rb
+1
-1
app/services/projects/lfs_pointers/lfs_link_service.rb
app/services/projects/lfs_pointers/lfs_link_service.rb
+1
-1
app/services/resource_events/change_labels_service.rb
app/services/resource_events/change_labels_service.rb
+1
-1
app/services/suggestions/create_service.rb
app/services/suggestions/create_service.rb
+1
-1
app/workers/gitlab/jira_import/import_issue_worker.rb
app/workers/gitlab/jira_import/import_issue_worker.rb
+2
-2
db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb
...00310215714_migrate_saml_identities_to_scim_identities.rb
+1
-1
ee/app/models/elasticsearch_indexed_namespace.rb
ee/app/models/elasticsearch_indexed_namespace.rb
+1
-1
ee/lib/ee/gitlab/background_migration/generate_gitlab_subscriptions.rb
...lab/background_migration/generate_gitlab_subscriptions.rb
+1
-1
lib/gitlab/background_migration/backfill_project_repositories.rb
...lab/background_migration/backfill_project_repositories.rb
+1
-1
lib/gitlab/background_migration/migrate_fingerprint_sha256_within_keys.rb
...round_migration/migrate_fingerprint_sha256_within_keys.rb
+1
-1
lib/gitlab/background_migration/migrate_issue_trackers_sensitive_data.rb
...ground_migration/migrate_issue_trackers_sensitive_data.rb
+1
-1
lib/gitlab/background_migration/populate_cluster_kubernetes_namespace_table.rb
..._migration/populate_cluster_kubernetes_namespace_table.rb
+1
-1
lib/gitlab/background_migration/populate_untracked_uploads.rb
...gitlab/background_migration/populate_untracked_uploads.rb
+1
-1
lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb
...d_migration/user_mentions/create_resource_user_mention.rb
+1
-1
lib/gitlab/github_import/bulk_importing.rb
lib/gitlab/github_import/bulk_importing.rb
+1
-1
lib/gitlab/github_import/importer/diff_note_importer.rb
lib/gitlab/github_import/importer/diff_note_importer.rb
+1
-1
lib/gitlab/github_import/importer/issue_importer.rb
lib/gitlab/github_import/importer/issue_importer.rb
+1
-1
lib/gitlab/github_import/importer/label_links_importer.rb
lib/gitlab/github_import/importer/label_links_importer.rb
+1
-1
lib/gitlab/github_import/importer/note_importer.rb
lib/gitlab/github_import/importer/note_importer.rb
+1
-1
lib/gitlab/import/database_helpers.rb
lib/gitlab/import/database_helpers.rb
+1
-1
spec/factories/design_management/designs.rb
spec/factories/design_management/designs.rb
+1
-1
No files found.
app/models/design_management/version.rb
View file @
c6bc992b
...
@@ -88,7 +88,7 @@ module DesignManagement
...
@@ -88,7 +88,7 @@ module DesignManagement
rows
=
design_actions
.
map
{
|
action
|
action
.
row_attrs
(
version
)
}
rows
=
design_actions
.
map
{
|
action
|
action
.
row_attrs
(
version
)
}
Gitlab
::
Database
.
bulk_insert
(
::
DesignManagement
::
Action
.
table_name
,
rows
)
Gitlab
::
Database
.
bulk_insert
(
::
DesignManagement
::
Action
.
table_name
,
rows
)
# rubocop:disable Gitlab/BulkInsert
version
.
designs
.
reset
version
.
designs
.
reset
version
.
validate!
version
.
validate!
design_actions
.
each
(
&
:performed
)
design_actions
.
each
(
&
:performed
)
...
...
app/models/merge_request_context_commit.rb
View file @
c6bc992b
...
@@ -20,7 +20,7 @@ class MergeRequestContextCommit < ApplicationRecord
...
@@ -20,7 +20,7 @@ class MergeRequestContextCommit < ApplicationRecord
# create MergeRequestContextCommit by given commit sha and it's diff file record
# create MergeRequestContextCommit by given commit sha and it's diff file record
def
self
.
bulk_insert
(
*
args
)
def
self
.
bulk_insert
(
*
args
)
Gitlab
::
Database
.
bulk_insert
(
'merge_request_context_commits'
,
*
args
)
Gitlab
::
Database
.
bulk_insert
(
'merge_request_context_commits'
,
*
args
)
# rubocop:disable Gitlab/BulkInsert
end
end
def
to_commit
def
to_commit
...
...
app/models/merge_request_context_commit_diff_file.rb
View file @
c6bc992b
...
@@ -12,6 +12,6 @@ class MergeRequestContextCommitDiffFile < ApplicationRecord
...
@@ -12,6 +12,6 @@ class MergeRequestContextCommitDiffFile < ApplicationRecord
# create MergeRequestContextCommitDiffFile by given diff file record(s)
# create MergeRequestContextCommitDiffFile by given diff file record(s)
def
self
.
bulk_insert
(
*
args
)
def
self
.
bulk_insert
(
*
args
)
Gitlab
::
Database
.
bulk_insert
(
'merge_request_context_commit_diff_files'
,
*
args
)
Gitlab
::
Database
.
bulk_insert
(
'merge_request_context_commit_diff_files'
,
*
args
)
# rubocop:disable Gitlab/BulkInsert
end
end
end
end
app/models/merge_request_diff.rb
View file @
c6bc992b
...
@@ -437,7 +437,7 @@ class MergeRequestDiff < ApplicationRecord
...
@@ -437,7 +437,7 @@ class MergeRequestDiff < ApplicationRecord
transaction
do
transaction
do
MergeRequestDiffFile
.
where
(
merge_request_diff_id:
id
).
delete_all
MergeRequestDiffFile
.
where
(
merge_request_diff_id:
id
).
delete_all
Gitlab
::
Database
.
bulk_insert
(
'merge_request_diff_files'
,
rows
)
Gitlab
::
Database
.
bulk_insert
(
'merge_request_diff_files'
,
rows
)
# rubocop:disable Gitlab/BulkInsert
update!
(
stored_externally:
false
)
update!
(
stored_externally:
false
)
end
end
...
@@ -495,7 +495,7 @@ class MergeRequestDiff < ApplicationRecord
...
@@ -495,7 +495,7 @@ class MergeRequestDiff < ApplicationRecord
rows
=
build_external_merge_request_diff_files
(
rows
)
if
use_external_diff?
rows
=
build_external_merge_request_diff_files
(
rows
)
if
use_external_diff?
# Faster inserts
# Faster inserts
Gitlab
::
Database
.
bulk_insert
(
'merge_request_diff_files'
,
rows
)
Gitlab
::
Database
.
bulk_insert
(
'merge_request_diff_files'
,
rows
)
# rubocop:disable Gitlab/BulkInsert
end
end
def
build_external_diff_tempfile
(
rows
)
def
build_external_diff_tempfile
(
rows
)
...
...
app/models/merge_request_diff_commit.rb
View file @
c6bc992b
...
@@ -27,6 +27,6 @@ class MergeRequestDiffCommit < ApplicationRecord
...
@@ -27,6 +27,6 @@ class MergeRequestDiffCommit < ApplicationRecord
)
)
end
end
Gitlab
::
Database
.
bulk_insert
(
self
.
table_name
,
rows
)
Gitlab
::
Database
.
bulk_insert
(
self
.
table_name
,
rows
)
# rubocop:disable Gitlab/BulkInsert
end
end
end
end
app/services/ci/extract_sections_from_build_trace_service.rb
View file @
c6bc992b
...
@@ -5,7 +5,7 @@ module Ci
...
@@ -5,7 +5,7 @@ module Ci
def
execute
(
build
)
def
execute
(
build
)
return
false
unless
build
.
trace_sections
.
empty?
return
false
unless
build
.
trace_sections
.
empty?
Gitlab
::
Database
.
bulk_insert
(
BuildTraceSection
.
table_name
,
extract_sections
(
build
))
Gitlab
::
Database
.
bulk_insert
(
BuildTraceSection
.
table_name
,
extract_sections
(
build
))
# rubocop:disable Gitlab/BulkInsert
true
true
end
end
...
...
app/services/issuable/clone/attributes_rewriter.rb
View file @
c6bc992b
...
@@ -105,7 +105,7 @@ module Issuable
...
@@ -105,7 +105,7 @@ module Issuable
yield
(
event
)
yield
(
event
)
end
.
compact
end
.
compact
Gitlab
::
Database
.
bulk_insert
(
table_name
,
events
)
Gitlab
::
Database
.
bulk_insert
(
table_name
,
events
)
# rubocop:disable Gitlab/BulkInsert
end
end
end
end
...
...
app/services/projects/detect_repository_languages_service.rb
View file @
c6bc992b
...
@@ -21,7 +21,7 @@ module Projects
...
@@ -21,7 +21,7 @@ module Projects
.
update_all
(
share:
update
[
:share
])
.
update_all
(
share:
update
[
:share
])
end
end
Gitlab
::
Database
.
bulk_insert
(
Gitlab
::
Database
.
bulk_insert
(
# rubocop:disable Gitlab/BulkInsert
RepositoryLanguage
.
table_name
,
RepositoryLanguage
.
table_name
,
detection
.
insertions
(
matching_programming_languages
)
detection
.
insertions
(
matching_programming_languages
)
)
)
...
...
app/services/projects/lfs_pointers/lfs_link_service.rb
View file @
c6bc992b
...
@@ -38,7 +38,7 @@ module Projects
...
@@ -38,7 +38,7 @@ module Projects
rows
=
existent_lfs_objects
rows
=
existent_lfs_objects
.
not_linked_to_project
(
project
)
.
not_linked_to_project
(
project
)
.
map
{
|
existing_lfs_object
|
{
project_id:
project
.
id
,
lfs_object_id:
existing_lfs_object
.
id
}
}
.
map
{
|
existing_lfs_object
|
{
project_id:
project
.
id
,
lfs_object_id:
existing_lfs_object
.
id
}
}
Gitlab
::
Database
.
bulk_insert
(
:lfs_objects_projects
,
rows
)
Gitlab
::
Database
.
bulk_insert
(
:lfs_objects_projects
,
rows
)
# rubocop:disable Gitlab/BulkInsert
iterations
+=
1
iterations
+=
1
linked_existing_objects
+=
existent_lfs_objects
.
map
(
&
:oid
)
linked_existing_objects
+=
existent_lfs_objects
.
map
(
&
:oid
)
...
...
app/services/resource_events/change_labels_service.rb
View file @
c6bc992b
...
@@ -22,7 +22,7 @@ module ResourceEvents
...
@@ -22,7 +22,7 @@ module ResourceEvents
label_hash
.
merge
(
label_id:
label
.
id
,
action:
ResourceLabelEvent
.
actions
[
'remove'
])
label_hash
.
merge
(
label_id:
label
.
id
,
action:
ResourceLabelEvent
.
actions
[
'remove'
])
end
end
Gitlab
::
Database
.
bulk_insert
(
ResourceLabelEvent
.
table_name
,
labels
)
Gitlab
::
Database
.
bulk_insert
(
ResourceLabelEvent
.
table_name
,
labels
)
# rubocop:disable Gitlab/BulkInsert
resource
.
expire_note_etag_cache
resource
.
expire_note_etag_cache
end
end
...
...
app/services/suggestions/create_service.rb
View file @
c6bc992b
...
@@ -25,7 +25,7 @@ module Suggestions
...
@@ -25,7 +25,7 @@ module Suggestions
end
end
rows
.
in_groups_of
(
100
,
false
)
do
|
rows
|
rows
.
in_groups_of
(
100
,
false
)
do
|
rows
|
Gitlab
::
Database
.
bulk_insert
(
'suggestions'
,
rows
)
Gitlab
::
Database
.
bulk_insert
(
'suggestions'
,
rows
)
# rubocop:disable Gitlab/BulkInsert
end
end
end
end
end
end
...
...
app/workers/gitlab/jira_import/import_issue_worker.rb
View file @
c6bc992b
...
@@ -48,7 +48,7 @@ module Gitlab
...
@@ -48,7 +48,7 @@ module Gitlab
label_link_attrs
<<
build_label_attrs
(
issue_id
,
import_label_id
.
to_i
)
label_link_attrs
<<
build_label_attrs
(
issue_id
,
import_label_id
.
to_i
)
Gitlab
::
Database
.
bulk_insert
(
LabelLink
.
table_name
,
label_link_attrs
)
Gitlab
::
Database
.
bulk_insert
(
LabelLink
.
table_name
,
label_link_attrs
)
# rubocop:disable Gitlab/BulkInsert
end
end
def
assign_issue
(
project_id
,
issue_id
,
assignee_ids
)
def
assign_issue
(
project_id
,
issue_id
,
assignee_ids
)
...
@@ -56,7 +56,7 @@ module Gitlab
...
@@ -56,7 +56,7 @@ module Gitlab
assignee_attrs
=
assignee_ids
.
map
{
|
user_id
|
{
issue_id:
issue_id
,
user_id:
user_id
}
}
assignee_attrs
=
assignee_ids
.
map
{
|
user_id
|
{
issue_id:
issue_id
,
user_id:
user_id
}
}
Gitlab
::
Database
.
bulk_insert
(
IssueAssignee
.
table_name
,
assignee_attrs
)
Gitlab
::
Database
.
bulk_insert
(
IssueAssignee
.
table_name
,
assignee_attrs
)
# rubocop:disable Gitlab/BulkInsert
end
end
def
build_label_attrs
(
issue_id
,
label_id
)
def
build_label_attrs
(
issue_id
,
label_id
)
...
...
db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb
View file @
c6bc992b
...
@@ -20,7 +20,7 @@ class MigrateSamlIdentitiesToScimIdentities < ActiveRecord::Migration[6.0]
...
@@ -20,7 +20,7 @@ class MigrateSamlIdentitiesToScimIdentities < ActiveRecord::Migration[6.0]
record
.
attributes
.
extract!
(
"extern_uid"
,
"user_id"
,
"group_id"
,
"active"
,
"created_at"
,
"updated_at"
)
record
.
attributes
.
extract!
(
"extern_uid"
,
"user_id"
,
"group_id"
,
"active"
,
"created_at"
,
"updated_at"
)
end
end
Gitlab
::
Database
.
bulk_insert
(
:scim_identities
,
data_to_insert
,
on_conflict: :do_nothing
)
Gitlab
::
Database
.
bulk_insert
(
:scim_identities
,
data_to_insert
,
on_conflict: :do_nothing
)
# rubocop:disable Gitlab/BulkInsert
end
end
end
end
...
...
ee/app/models/elasticsearch_indexed_namespace.rb
View file @
c6bc992b
...
@@ -37,7 +37,7 @@ class ElasticsearchIndexedNamespace < ApplicationRecord
...
@@ -37,7 +37,7 @@ class ElasticsearchIndexedNamespace < ApplicationRecord
{
created_at:
now
,
updated_at:
now
,
namespace_id:
id
}
{
created_at:
now
,
updated_at:
now
,
namespace_id:
id
}
end
end
Gitlab
::
Database
.
bulk_insert
(
table_name
,
insert_rows
)
Gitlab
::
Database
.
bulk_insert
(
table_name
,
insert_rows
)
# rubocop:disable Gitlab/BulkInsert
invalidate_elasticsearch_indexes_project_cache!
invalidate_elasticsearch_indexes_project_cache!
jobs
=
batch_ids
.
map
{
|
id
|
[
id
,
:index
]
}
jobs
=
batch_ids
.
map
{
|
id
|
[
id
,
:index
]
}
...
...
ee/lib/ee/gitlab/background_migration/generate_gitlab_subscriptions.rb
View file @
c6bc992b
...
@@ -49,7 +49,7 @@ module EE
...
@@ -49,7 +49,7 @@ module EE
}
}
end
end
Gitlab
::
Database
.
bulk_insert
(
:gitlab_subscriptions
,
rows
)
Gitlab
::
Database
.
bulk_insert
(
:gitlab_subscriptions
,
rows
)
# rubocop:disable Gitlab/BulkInsert
end
end
end
end
end
end
...
...
lib/gitlab/background_migration/backfill_project_repositories.rb
View file @
c6bc992b
...
@@ -189,7 +189,7 @@ module Gitlab
...
@@ -189,7 +189,7 @@ module Gitlab
end
end
def
perform
(
start_id
,
stop_id
)
def
perform
(
start_id
,
stop_id
)
Gitlab
::
Database
.
bulk_insert
(
:project_repositories
,
project_repositories
(
start_id
,
stop_id
))
Gitlab
::
Database
.
bulk_insert
(
:project_repositories
,
project_repositories
(
start_id
,
stop_id
))
# rubocop:disable Gitlab/BulkInsert
end
end
private
private
...
...
lib/gitlab/background_migration/migrate_fingerprint_sha256_within_keys.rb
View file @
c6bc992b
...
@@ -34,7 +34,7 @@ module Gitlab
...
@@ -34,7 +34,7 @@ module Gitlab
end
end
end
end
Gitlab
::
Database
.
bulk_insert
(
TEMP_TABLE
,
fingerprints
)
Gitlab
::
Database
.
bulk_insert
(
TEMP_TABLE
,
fingerprints
)
# rubocop:disable Gitlab/BulkInsert
execute
(
"ANALYZE
#{
TEMP_TABLE
}
"
)
execute
(
"ANALYZE
#{
TEMP_TABLE
}
"
)
...
...
lib/gitlab/background_migration/migrate_issue_trackers_sensitive_data.rb
View file @
c6bc992b
...
@@ -65,7 +65,7 @@ module Gitlab
...
@@ -65,7 +65,7 @@ module Gitlab
next
if
service_ids
.
empty?
next
if
service_ids
.
empty?
migrated_ids
+=
service_ids
migrated_ids
+=
service_ids
Gitlab
::
Database
.
bulk_insert
(
table
,
data
)
Gitlab
::
Database
.
bulk_insert
(
table
,
data
)
# rubocop:disable Gitlab/BulkInsert
end
end
return
if
migrated_ids
.
empty?
return
if
migrated_ids
.
empty?
...
...
lib/gitlab/background_migration/populate_cluster_kubernetes_namespace_table.rb
View file @
c6bc992b
...
@@ -73,7 +73,7 @@ module Gitlab
...
@@ -73,7 +73,7 @@ module Gitlab
end
end
def
insert_into_cluster_kubernetes_namespace
(
rows
)
def
insert_into_cluster_kubernetes_namespace
(
rows
)
Gitlab
::
Database
.
bulk_insert
(
Migratable
::
KubernetesNamespace
.
table_name
,
Gitlab
::
Database
.
bulk_insert
(
Migratable
::
KubernetesNamespace
.
table_name
,
# rubocop:disable Gitlab/BulkInsert
rows
,
rows
,
disable_quote:
[
:created_at
,
:updated_at
])
disable_quote:
[
:created_at
,
:updated_at
])
end
end
...
...
lib/gitlab/background_migration/populate_untracked_uploads.rb
View file @
c6bc992b
...
@@ -95,7 +95,7 @@ module Gitlab
...
@@ -95,7 +95,7 @@ module Gitlab
file
.
to_h
.
merge
(
created_at:
'NOW()'
)
file
.
to_h
.
merge
(
created_at:
'NOW()'
)
end
end
Gitlab
::
Database
.
bulk_insert
(
'uploads'
,
Gitlab
::
Database
.
bulk_insert
(
'uploads'
,
# rubocop:disable Gitlab/BulkInsert
rows
,
rows
,
disable_quote: :created_at
)
disable_quote: :created_at
)
end
end
...
...
lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb
View file @
c6bc992b
...
@@ -25,7 +25,7 @@ module Gitlab
...
@@ -25,7 +25,7 @@ module Gitlab
mentions
<<
mention_record
unless
mention_record
.
blank?
mentions
<<
mention_record
unless
mention_record
.
blank?
end
end
Gitlab
::
Database
.
bulk_insert
(
Gitlab
::
Database
.
bulk_insert
(
# rubocop:disable Gitlab/BulkInsert
resource_user_mention_model
.
table_name
,
resource_user_mention_model
.
table_name
,
mentions
,
mentions
,
return_ids:
true
,
return_ids:
true
,
...
...
lib/gitlab/github_import/bulk_importing.rb
View file @
c6bc992b
...
@@ -17,7 +17,7 @@ module Gitlab
...
@@ -17,7 +17,7 @@ module Gitlab
# Bulk inserts the given rows into the database.
# Bulk inserts the given rows into the database.
def
bulk_insert
(
model
,
rows
,
batch_size:
100
)
def
bulk_insert
(
model
,
rows
,
batch_size:
100
)
rows
.
each_slice
(
batch_size
)
do
|
slice
|
rows
.
each_slice
(
batch_size
)
do
|
slice
|
Gitlab
::
Database
.
bulk_insert
(
model
.
table_name
,
slice
)
Gitlab
::
Database
.
bulk_insert
(
model
.
table_name
,
slice
)
# rubocop:disable Gitlab/BulkInsert
end
end
end
end
end
end
...
...
lib/gitlab/github_import/importer/diff_note_importer.rb
View file @
c6bc992b
...
@@ -47,7 +47,7 @@ module Gitlab
...
@@ -47,7 +47,7 @@ module Gitlab
# To work around this we're using bulk_insert with a single row. This
# To work around this we're using bulk_insert with a single row. This
# allows us to efficiently insert data (even if it's just 1 row)
# allows us to efficiently insert data (even if it's just 1 row)
# without having to use all sorts of hacks to disable callbacks.
# without having to use all sorts of hacks to disable callbacks.
Gitlab
::
Database
.
bulk_insert
(
LegacyDiffNote
.
table_name
,
[
attributes
])
Gitlab
::
Database
.
bulk_insert
(
LegacyDiffNote
.
table_name
,
[
attributes
])
# rubocop:disable Gitlab/BulkInsert
rescue
ActiveRecord
::
InvalidForeignKey
rescue
ActiveRecord
::
InvalidForeignKey
# It's possible the project and the issue have been deleted since
# It's possible the project and the issue have been deleted since
# scheduling this job. In this case we'll just skip creating the note.
# scheduling this job. In this case we'll just skip creating the note.
...
...
lib/gitlab/github_import/importer/issue_importer.rb
View file @
c6bc992b
...
@@ -75,7 +75,7 @@ module Gitlab
...
@@ -75,7 +75,7 @@ module Gitlab
end
end
end
end
Gitlab
::
Database
.
bulk_insert
(
IssueAssignee
.
table_name
,
assignees
)
Gitlab
::
Database
.
bulk_insert
(
IssueAssignee
.
table_name
,
assignees
)
# rubocop:disable Gitlab/BulkInsert
end
end
end
end
end
end
...
...
lib/gitlab/github_import/importer/label_links_importer.rb
View file @
c6bc992b
...
@@ -40,7 +40,7 @@ module Gitlab
...
@@ -40,7 +40,7 @@ module Gitlab
}
}
end
end
Gitlab
::
Database
.
bulk_insert
(
LabelLink
.
table_name
,
rows
)
Gitlab
::
Database
.
bulk_insert
(
LabelLink
.
table_name
,
rows
)
# rubocop:disable Gitlab/BulkInsert
end
end
def
find_target_id
def
find_target_id
...
...
lib/gitlab/github_import/importer/note_importer.rb
View file @
c6bc992b
...
@@ -38,7 +38,7 @@ module Gitlab
...
@@ -38,7 +38,7 @@ module Gitlab
# We're using bulk_insert here so we can bypass any validations and
# We're using bulk_insert here so we can bypass any validations and
# callbacks. Running these would result in a lot of unnecessary SQL
# callbacks. Running these would result in a lot of unnecessary SQL
# queries being executed when importing large projects.
# queries being executed when importing large projects.
Gitlab
::
Database
.
bulk_insert
(
Note
.
table_name
,
[
attributes
])
Gitlab
::
Database
.
bulk_insert
(
Note
.
table_name
,
[
attributes
])
# rubocop:disable Gitlab/BulkInsert
rescue
ActiveRecord
::
InvalidForeignKey
rescue
ActiveRecord
::
InvalidForeignKey
# It's possible the project and the issue have been deleted since
# It's possible the project and the issue have been deleted since
# scheduling this job. In this case we'll just skip creating the note.
# scheduling this job. In this case we'll just skip creating the note.
...
...
lib/gitlab/import/database_helpers.rb
View file @
c6bc992b
...
@@ -11,7 +11,7 @@ module Gitlab
...
@@ -11,7 +11,7 @@ module Gitlab
# We use bulk_insert here so we can bypass any queries executed by
# We use bulk_insert here so we can bypass any queries executed by
# callbacks or validation rules, as doing this wouldn't scale when
# callbacks or validation rules, as doing this wouldn't scale when
# importing very large projects.
# importing very large projects.
result
=
Gitlab
::
Database
result
=
Gitlab
::
Database
# rubocop:disable Gitlab/BulkInsert
.
bulk_insert
(
relation
.
table_name
,
[
attributes
],
return_ids:
true
)
.
bulk_insert
(
relation
.
table_name
,
[
attributes
],
return_ids:
true
)
result
.
first
result
.
first
...
...
spec/factories/design_management/designs.rb
View file @
c6bc992b
...
@@ -35,7 +35,7 @@ FactoryBot.define do
...
@@ -35,7 +35,7 @@ FactoryBot.define do
sha
=
commit_version
[
action
]
sha
=
commit_version
[
action
]
version
=
DesignManagement
::
Version
.
new
(
sha:
sha
,
issue:
issue
,
author:
evaluator
.
author
)
version
=
DesignManagement
::
Version
.
new
(
sha:
sha
,
issue:
issue
,
author:
evaluator
.
author
)
version
.
save
(
validate:
false
)
# We need it to have an ID, validate later
version
.
save
(
validate:
false
)
# We need it to have an ID, validate later
Gitlab
::
Database
.
bulk_insert
(
dv_table_name
,
[
action
.
row_attrs
(
version
)])
Gitlab
::
Database
.
bulk_insert
(
dv_table_name
,
[
action
.
row_attrs
(
version
)])
# rubocop:disable Gitlab/BulkInsert
end
end
# always a creation
# always a creation
...
...
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