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
d3d4d020
Commit
d3d4d020
authored
May 19, 2020
by
Patrick Derichs
Committed by
Adam Hegyi
Jun 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update constraint on resource_state_events table
parent
b26c70be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb
...te_resource_state_events_constraint_to_support_epic_id.rb
+24
-0
db/structure.sql
db/structure.sql
+2
-1
No files found.
db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb
0 → 100644
View file @
d3d4d020
# frozen_string_literal: true
class
UpdateResourceStateEventsConstraintToSupportEpicId
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
OLD_CONSTRAINT
=
'resource_state_events_must_belong_to_issue_or_merge_request'
CONSTRAINT_NAME
=
'resource_state_events_must_belong_to_issue_or_merge_request_or_epic'
def
up
remove_check_constraint
:resource_state_events
,
OLD_CONSTRAINT
add_check_constraint
:resource_state_events
,
"(issue_id != NULL AND merge_request_id IS NULL AND epic_id IS NULL) OR "
\
"(issue_id IS NULL AND merge_request_id != NULL AND epic_id IS NULL) OR"
\
"(issue_id IS NULL AND merge_request_id IS NULL AND epic_id != NULL)"
,
CONSTRAINT_NAME
end
def
down
remove_check_constraint
:resource_state_events
,
CONSTRAINT_NAME
add_check_constraint
:resource_state_events
,
'(issue_id != NULL AND merge_request_id IS NULL) OR (merge_request_id != NULL AND issue_id IS NULL)'
,
OLD_CONSTRAINT
end
end
db/structure.sql
View file @
d3d4d020
...
...
@@ -5895,7 +5895,7 @@ CREATE TABLE public.resource_state_events (
created_at
timestamp
with
time
zone
NOT
NULL
,
state
smallint
NOT
NULL
,
epic_id
integer
,
CONSTRAINT
resource_state_events_must_belong_to_issue_or_merge_request
CHECK
((((
issue_id
<>
NULL
::
bigint
)
AND
(
merge_request_id
IS
NULL
))
OR
((
merge_request_id
<>
NULL
::
bigint
)
AND
(
issue_id
IS
NULL
))))
CONSTRAINT
resource_state_events_must_belong_to_issue_or_merge_request
_or_
CHECK
((((
issue_id
<>
NULL
::
bigint
)
AND
(
merge_request_id
IS
NULL
)
AND
(
epic_id
IS
NULL
))
OR
((
issue_id
IS
NULL
)
AND
(
merge_request_id
<>
NULL
::
bigint
)
AND
(
epic_id
IS
NULL
))
OR
((
issue_id
IS
NULL
)
AND
(
merge_request_id
IS
NULL
)
AND
(
epic_id
<>
NULL
::
integer
))))
);
CREATE
SEQUENCE
public
.
resource_state_events_id_seq
...
...
@@ -14026,6 +14026,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200515155620
20200518091745
20200518133123
20200519074709
20200519101002
20200519115908
20200519171058
...
...
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