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
db1c7c80
Commit
db1c7c80
authored
Nov 27, 2020
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added models for epic board and epic board labels
This is similar to issue board labels.
parent
f506606f
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
181 additions
and
0 deletions
+181
-0
changelogs/unreleased/epic_boards.yml
changelogs/unreleased/epic_boards.yml
+5
-0
db/migrate/20201126165919_add_epic_boards.rb
db/migrate/20201126165919_add_epic_boards.rb
+29
-0
db/migrate/20201126190039_add_epic_board_labels.rb
db/migrate/20201126190039_add_epic_board_labels.rb
+24
-0
db/schema_migrations/20201126165919
db/schema_migrations/20201126165919
+1
-0
db/schema_migrations/20201126190039
db/schema_migrations/20201126190039
+1
-0
db/structure.sql
db/structure.sql
+60
-0
ee/app/models/boards.rb
ee/app/models/boards.rb
+7
-0
ee/app/models/boards/epic_board.rb
ee/app/models/boards/epic_board.rb
+10
-0
ee/app/models/boards/epic_board_label.rb
ee/app/models/boards/epic_board_label.rb
+8
-0
ee/app/models/ee/group.rb
ee/app/models/ee/group.rb
+1
-0
ee/app/models/ee/label.rb
ee/app/models/ee/label.rb
+4
-0
ee/spec/models/boards/epic_board_label_spec.rb
ee/spec/models/boards/epic_board_label_spec.rb
+10
-0
ee/spec/models/boards/epic_board_spec.rb
ee/spec/models/boards/epic_board_spec.rb
+14
-0
ee/spec/models/ee/label_spec.rb
ee/spec/models/ee/label_spec.rb
+4
-0
ee/spec/models/group_spec.rb
ee/spec/models/group_spec.rb
+2
-0
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-0
No files found.
changelogs/unreleased/epic_boards.yml
0 → 100644
View file @
db1c7c80
---
title
:
Added epic boards and epic board labels tables
merge_request
:
48658
author
:
type
:
added
db/migrate/20201126165919_add_epic_boards.rb
0 → 100644
View file @
db1c7c80
# frozen_string_literal: true
class
AddEpicBoards
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
with_lock_retries
do
create_table
:boards_epic_boards
do
|
t
|
t
.
boolean
:hide_backlog_list
,
default:
false
,
null:
false
t
.
boolean
:hide_closed_list
,
default:
false
,
null:
false
t
.
references
:group
,
index:
true
,
foreign_key:
{
to_table: :namespaces
,
on_delete: :cascade
},
null:
false
t
.
timestamps_with_timezone
t
.
text
:name
,
default:
'Development'
,
null:
false
end
end
add_text_limit
:boards_epic_boards
,
:name
,
255
end
def
down
with_lock_retries
do
drop_table
:boards_epic_boards
end
end
end
db/migrate/20201126190039_add_epic_board_labels.rb
0 → 100644
View file @
db1c7c80
# frozen_string_literal: true
class
AddEpicBoardLabels
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
with_lock_retries
do
create_table
:boards_epic_board_labels
do
|
t
|
t
.
references
:epic_board
,
index:
true
,
foreign_key:
{
to_table: :boards_epic_boards
,
on_delete: :cascade
},
null:
false
t
.
references
:label
,
index:
true
,
foreign_key:
{
on_delete: :cascade
},
null:
false
end
end
end
def
down
with_lock_retries
do
drop_table
:boards_epic_board_labels
end
end
end
db/schema_migrations/20201126165919
0 → 100644
View file @
db1c7c80
a68c609800f5bdb0a77e39f706b410477493e7b7db3af11e4b2a67534df31079
\ No newline at end of file
db/schema_migrations/20201126190039
0 → 100644
View file @
db1c7c80
65935afe9b4ad195aaf31cddb915dcd62b23674e278e93ce7ff9b4ae98e32331
\ No newline at end of file
db/structure.sql
View file @
db1c7c80
...
...
@@ -9849,6 +9849,41 @@ CREATE TABLE boards (
hide_closed_list
boolean
DEFAULT
false
NOT
NULL
);
CREATE
TABLE
boards_epic_board_labels
(
id
bigint
NOT
NULL
,
epic_board_id
bigint
NOT
NULL
,
label_id
bigint
NOT
NULL
);
CREATE
SEQUENCE
boards_epic_board_labels_id_seq
START
WITH
1
INCREMENT
BY
1
NO
MINVALUE
NO
MAXVALUE
CACHE
1
;
ALTER
SEQUENCE
boards_epic_board_labels_id_seq
OWNED
BY
boards_epic_board_labels
.
id
;
CREATE
TABLE
boards_epic_boards
(
id
bigint
NOT
NULL
,
hide_backlog_list
boolean
DEFAULT
false
NOT
NULL
,
hide_closed_list
boolean
DEFAULT
false
NOT
NULL
,
group_id
bigint
NOT
NULL
,
created_at
timestamp
with
time
zone
NOT
NULL
,
updated_at
timestamp
with
time
zone
NOT
NULL
,
name
text
DEFAULT
'Development'
::
text
NOT
NULL
,
CONSTRAINT
check_bcbbffe601
CHECK
((
char_length
(
name
)
<=
255
))
);
CREATE
SEQUENCE
boards_epic_boards_id_seq
START
WITH
1
INCREMENT
BY
1
NO
MINVALUE
NO
MAXVALUE
CACHE
1
;
ALTER
SEQUENCE
boards_epic_boards_id_seq
OWNED
BY
boards_epic_boards
.
id
;
CREATE
TABLE
boards_epic_user_preferences
(
id
bigint
NOT
NULL
,
board_id
bigint
NOT
NULL
,
...
...
@@ -17876,6 +17911,10 @@ ALTER TABLE ONLY board_user_preferences ALTER COLUMN id SET DEFAULT nextval('boa
ALTER
TABLE
ONLY
boards
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'boards_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
boards_epic_board_labels
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'boards_epic_board_labels_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
boards_epic_boards
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'boards_epic_boards_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
boards_epic_user_preferences
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'boards_epic_user_preferences_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
broadcast_messages
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'broadcast_messages_id_seq'
::
regclass
);
...
...
@@ -18904,6 +18943,12 @@ ALTER TABLE ONLY board_project_recent_visits
ALTER
TABLE
ONLY
board_user_preferences
ADD
CONSTRAINT
board_user_preferences_pkey
PRIMARY
KEY
(
id
);
ALTER
TABLE
ONLY
boards_epic_board_labels
ADD
CONSTRAINT
boards_epic_board_labels_pkey
PRIMARY
KEY
(
id
);
ALTER
TABLE
ONLY
boards_epic_boards
ADD
CONSTRAINT
boards_epic_boards_pkey
PRIMARY
KEY
(
id
);
ALTER
TABLE
ONLY
boards_epic_user_preferences
ADD
CONSTRAINT
boards_epic_user_preferences_pkey
PRIMARY
KEY
(
id
);
...
...
@@ -20523,6 +20568,12 @@ CREATE INDEX index_board_user_preferences_on_user_id ON board_user_preferences U
CREATE
UNIQUE
INDEX
index_board_user_preferences_on_user_id_and_board_id
ON
board_user_preferences
USING
btree
(
user_id
,
board_id
);
CREATE
INDEX
index_boards_epic_board_labels_on_epic_board_id
ON
boards_epic_board_labels
USING
btree
(
epic_board_id
);
CREATE
INDEX
index_boards_epic_board_labels_on_label_id
ON
boards_epic_board_labels
USING
btree
(
label_id
);
CREATE
INDEX
index_boards_epic_boards_on_group_id
ON
boards_epic_boards
USING
btree
(
group_id
);
CREATE
INDEX
index_boards_epic_user_preferences_on_board_id
ON
boards_epic_user_preferences
USING
btree
(
board_id
);
CREATE
UNIQUE
INDEX
index_boards_epic_user_preferences_on_board_user_epic_unique
ON
boards_epic_user_preferences
USING
btree
(
board_id
,
user_id
,
epic_id
);
...
...
@@ -23842,6 +23893,9 @@ ALTER TABLE ONLY group_group_links
ALTER
TABLE
ONLY
geo_repository_updated_events
ADD
CONSTRAINT
fk_rails_2b70854c08
FOREIGN
KEY
(
project_id
)
REFERENCES
projects
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
boards_epic_board_labels
ADD
CONSTRAINT
fk_rails_2bedeb8799
FOREIGN
KEY
(
label_id
)
REFERENCES
labels
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
protected_branch_unprotect_access_levels
ADD
CONSTRAINT
fk_rails_2d2aba21ef
FOREIGN
KEY
(
user_id
)
REFERENCES
users
(
id
)
ON
DELETE
CASCADE
;
...
...
@@ -24247,6 +24301,9 @@ ALTER TABLE ONLY slack_integrations
ALTER
TABLE
ONLY
custom_emoji
ADD
CONSTRAINT
fk_rails_745925b412
FOREIGN
KEY
(
namespace_id
)
REFERENCES
namespaces
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
boards_epic_board_labels
ADD
CONSTRAINT
fk_rails_7471128a8e
FOREIGN
KEY
(
epic_board_id
)
REFERENCES
boards_epic_boards
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
dast_site_profiles
ADD
CONSTRAINT
fk_rails_747dc64abc
FOREIGN
KEY
(
dast_site_id
)
REFERENCES
dast_sites
(
id
)
ON
DELETE
CASCADE
;
...
...
@@ -24331,6 +24388,9 @@ ALTER TABLE ONLY clusters_applications_crossplane
ALTER
TABLE
ONLY
packages_package_file_build_infos
ADD
CONSTRAINT
fk_rails_871ca3ae21
FOREIGN
KEY
(
package_file_id
)
REFERENCES
packages_package_files
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
boards_epic_boards
ADD
CONSTRAINT
fk_rails_874c573878
FOREIGN
KEY
(
group_id
)
REFERENCES
namespaces
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
ci_runner_namespaces
ADD
CONSTRAINT
fk_rails_8767676b7a
FOREIGN
KEY
(
runner_id
)
REFERENCES
ci_runners
(
id
)
ON
DELETE
CASCADE
;
...
...
ee/app/models/boards.rb
0 → 100644
View file @
db1c7c80
# frozen_string_literal: true
module
Boards
def
self
.
table_name_prefix
'boards_'
end
end
ee/app/models/boards/epic_board.rb
0 → 100644
View file @
db1c7c80
# frozen_string_literal: true
module
Boards
class
EpicBoard
<
ApplicationRecord
belongs_to
:group
,
optional:
false
,
inverse_of: :epic_boards
has_many
:epic_board_labels
,
foreign_key: :epic_board_id
,
inverse_of: :epic_board
validates
:name
,
length:
{
maximum:
255
}
end
end
ee/app/models/boards/epic_board_label.rb
0 → 100644
View file @
db1c7c80
# frozen_string_literal: true
module
Boards
class
EpicBoardLabel
<
ApplicationRecord
belongs_to
:epic_board
,
optional:
false
,
inverse_of: :epic_board_labels
belongs_to
:label
,
optional:
false
,
inverse_of: :epic_board_labels
end
end
ee/app/models/ee/group.rb
View file @
db1c7c80
...
...
@@ -18,6 +18,7 @@ module EE
add_authentication_token_field
:saml_discovery_token
,
unique:
false
,
token_generator:
->
{
Devise
.
friendly_token
(
8
)
}
has_many
:epics
has_many
:epic_boards
,
class_name:
'Boards::EpicBoard'
,
inverse_of: :group
has_one
:saml_provider
has_many
:scim_identities
...
...
ee/app/models/ee/label.rb
View file @
db1c7c80
...
...
@@ -7,6 +7,10 @@ module EE
SCOPED_LABEL_SEPARATOR
=
'::'
SCOPED_LABEL_PATTERN
=
/^.*
#{
SCOPED_LABEL_SEPARATOR
}
/
.
freeze
prepended
do
has_many
:epic_board_labels
,
class_name:
'Boards::EpicBoardLabel'
,
inverse_of: :label
end
def
scoped_label?
SCOPED_LABEL_PATTERN
.
match?
(
name
)
end
...
...
ee/spec/models/boards/epic_board_label_spec.rb
0 → 100644
View file @
db1c7c80
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Boards
::
EpicBoardLabel
do
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:epic_board
).
required
.
inverse_of
(
:epic_board_labels
)
}
it
{
is_expected
.
to
belong_to
(
:label
).
required
.
inverse_of
(
:epic_board_labels
)
}
end
end
ee/spec/models/boards/epic_board_spec.rb
0 → 100644
View file @
db1c7c80
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Boards
::
EpicBoard
do
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:group
).
required
.
inverse_of
(
:epic_boards
)
}
it
{
is_expected
.
to
have_many
(
:epic_board_labels
).
inverse_of
(
:epic_board
)
}
end
describe
'validations'
do
it
{
is_expected
.
to
validate_length_of
(
:name
).
is_at_most
(
255
)
}
end
end
ee/spec/models/ee/label_spec.rb
View file @
db1c7c80
...
...
@@ -3,6 +3,10 @@
require
'spec_helper'
RSpec
.
describe
Label
do
describe
'associations'
do
it
{
is_expected
.
to
have_many
(
:epic_board_labels
).
inverse_of
(
:label
)
}
end
describe
'#scoped_label?'
do
context
'with scoped_labels available'
do
before
do
...
...
ee/spec/models/group_spec.rb
View file @
db1c7c80
...
...
@@ -22,6 +22,8 @@ RSpec.describe Group do
it
{
is_expected
.
to
have_one
(
:group_wiki_repository
)
}
it
{
is_expected
.
to
belong_to
(
:push_rule
)
}
it
{
is_expected
.
to
have_many
(
:saml_group_links
)
}
it
{
is_expected
.
to
have_many
(
:epics
)
}
it
{
is_expected
.
to
have_many
(
:epic_boards
).
inverse_of
(
:group
)
}
it_behaves_like
'model with wiki'
do
let
(
:container
)
{
create
(
:group
,
:nested
,
:wiki_repo
)
}
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
db1c7c80
...
...
@@ -86,6 +86,7 @@ label:
-
issues
-
merge_requests
-
priorities
-
epic_board_labels
milestone
:
-
group
-
project
...
...
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