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
Jérome Perrin
gitlab-ce
Commits
9afabee3
Commit
9afabee3
authored
Mar 29, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use STI mechanisms when migrating pipeline stages
parent
3577009a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
lib/gitlab/background_migration/migrate_build_stage.rb
lib/gitlab/background_migration/migrate_build_stage.rb
+1
-0
spec/lib/gitlab/background_migration/migrate_build_stage_spec.rb
...b/gitlab/background_migration/migrate_build_stage_spec.rb
+16
-0
No files found.
lib/gitlab/background_migration/migrate_build_stage.rb
View file @
9afabee3
...
...
@@ -12,6 +12,7 @@ module Gitlab
class
Build
<
ActiveRecord
::
Base
self
.
table_name
=
'ci_builds'
self
.
inheritance_column
=
:_type_disabled
def
ensure_stage!
(
attempts:
2
)
find_stage
||
create_stage!
...
...
spec/lib/gitlab/background_migration/migrate_build_stage_spec.rb
View file @
9afabee3
...
...
@@ -51,4 +51,20 @@ describe Gitlab::BackgroundMigration::MigrateBuildStage, :migration, schema: 201
expect
{
described_class
.
new
.
perform
(
1
,
6
)
}
.
to
raise_error
ActiveRecord
::
RecordNotUnique
end
context
'when invalid class can be loaded due to single table inheritance'
do
let
(
:commit_status
)
do
jobs
.
create!
(
id:
7
,
commit_id:
1
,
project_id:
123
,
stage_idx:
4
,
stage:
'post-deploy'
,
status: :failed
)
end
before
do
commit_status
.
update_column
(
:type
,
'SomeClass'
)
end
it
'does ignore single table inheritance type'
do
expect
{
described_class
.
new
.
perform
(
1
,
7
)
}.
not_to
raise_error
expect
(
jobs
.
find
(
7
)).
to
have_attributes
(
stage_id:
(
a_value
>
0
))
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