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
daaacbdc
Commit
daaacbdc
authored
May 11, 2020
by
Patrick Derichs
Committed by
Adam Hegyi
May 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add epic_id to resource_state_events
With foreign key to epics and index on epic_id
parent
bd056f74
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
0 deletions
+49
-0
changelogs/unreleased/add-epic-id-to-resource-state-event-pd.yml
...ogs/unreleased/add-epic-id-to-resource-state-event-pd.yml
+5
-0
db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb
...te/20200511092246_add_epic_id_to_resource_state_events.rb
+17
-0
db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb
...05_add_foreign_key_to_epic_id_on_resource_state_events.rb
+19
-0
db/structure.sql
db/structure.sql
+8
-0
No files found.
changelogs/unreleased/add-epic-id-to-resource-state-event-pd.yml
0 → 100644
View file @
daaacbdc
---
title
:
Add epic_id to resource_state_events
merge_request
:
31587
author
:
type
:
other
db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb
0 → 100644
View file @
daaacbdc
# frozen_string_literal: true
class
AddEpicIdToResourceStateEvents
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
INDEX_NAME
=
'index_resource_state_events_on_epic_id'
def
up
add_column
:resource_state_events
,
:epic_id
,
:integer
add_index
:resource_state_events
,
:epic_id
,
name:
INDEX_NAME
# rubocop:disable Migration/AddIndex
end
def
down
remove_index
:resource_state_events
,
name:
INDEX_NAME
# rubocop:disable Migration/RemoveIndex
remove_column
:resource_state_events
,
:epic_id
,
:integer
end
end
db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb
0 → 100644
View file @
daaacbdc
# frozen_string_literal: true
class
AddForeignKeyToEpicIdOnResourceStateEvents
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
with_lock_retries
do
add_foreign_key
:resource_state_events
,
:epics
,
column: :epic_id
,
on_delete: :cascade
# rubocop:disable Migration/AddConcurrentForeignKey
end
end
def
down
with_lock_retries
do
remove_foreign_key
:resource_state_events
,
column: :epic_id
end
end
end
db/structure.sql
View file @
daaacbdc
...
...
@@ -5812,6 +5812,7 @@ CREATE TABLE public.resource_state_events (
merge_request_id
bigint
,
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
))))
);
...
...
@@ -10521,6 +10522,8 @@ CREATE INDEX index_resource_milestone_events_on_milestone_id ON public.resource_
CREATE
INDEX
index_resource_milestone_events_on_user_id
ON
public
.
resource_milestone_events
USING
btree
(
user_id
);
CREATE
INDEX
index_resource_state_events_on_epic_id
ON
public
.
resource_state_events
USING
btree
(
epic_id
);
CREATE
INDEX
index_resource_state_events_on_issue_id_and_created_at
ON
public
.
resource_state_events
USING
btree
(
issue_id
,
created_at
);
CREATE
INDEX
index_resource_state_events_on_merge_request_id
ON
public
.
resource_state_events
USING
btree
(
merge_request_id
);
...
...
@@ -12412,6 +12415,9 @@ ALTER TABLE ONLY public.vulnerability_occurrences
ALTER
TABLE
ONLY
public
.
project_export_jobs
ADD
CONSTRAINT
fk_rails_c88d8db2e1
FOREIGN
KEY
(
project_id
)
REFERENCES
public
.
projects
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
public
.
resource_state_events
ADD
CONSTRAINT
fk_rails_c913c64977
FOREIGN
KEY
(
epic_id
)
REFERENCES
public
.
epics
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
public
.
resource_milestone_events
ADD
CONSTRAINT
fk_rails_c940fb9fc5
FOREIGN
KEY
(
milestone_id
)
REFERENCES
public
.
milestones
(
id
)
ON
DELETE
CASCADE
;
...
...
@@ -13809,6 +13815,8 @@ COPY "schema_migrations" (version) FROM STDIN;
20200506154421
20200507221434
20200508091106
20200511092246
20200511092505
20200511092714
20200511115430
20200511115431
...
...
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