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
9c4fb2ce
Commit
9c4fb2ce
authored
Sep 28, 2020
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce required_code_owners_sections table
It's required to implement section based approval rules
parent
8a5e9d54
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
81 additions
and
0 deletions
+81
-0
changelogs/unreleased/id-required-sections.yml
changelogs/unreleased/id-required-sections.yml
+5
-0
db/migrate/20200928131934_create_required_code_owners_sections.rb
...te/20200928131934_create_required_code_owners_sections.rb
+26
-0
db/schema_migrations/20200928131934
db/schema_migrations/20200928131934
+1
-0
db/structure.sql
db/structure.sql
+26
-0
ee/app/models/concerns/ee/protected_branch.rb
ee/app/models/concerns/ee/protected_branch.rb
+2
-0
ee/app/models/protected_branch/required_code_owners_section.rb
...p/models/protected_branch/required_code_owners_section.rb
+7
-0
ee/spec/models/ee/protected_branch_spec.rb
ee/spec/models/ee/protected_branch_spec.rb
+4
-0
ee/spec/models/protected_branch/required_code_owners_section_spec.rb
...els/protected_branch/required_code_owners_section_spec.rb
+9
-0
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-0
No files found.
changelogs/unreleased/id-required-sections.yml
0 → 100644
View file @
9c4fb2ce
---
title
:
Introduce required_code_owners_sections table
merge_request
:
43573
author
:
type
:
added
db/migrate/20200928131934_create_required_code_owners_sections.rb
0 → 100644
View file @
9c4fb2ce
# frozen_string_literal: true
class
CreateRequiredCodeOwnersSections
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
with_lock_retries
do
create_table
:required_code_owners_sections
,
if_not_exists:
true
do
|
t
|
t
.
references
:protected_branch
,
null:
false
,
foreign_key:
{
on_delete: :cascade
}
t
.
text
:name
,
null:
false
end
end
add_text_limit
:required_code_owners_sections
,
:name
,
1024
end
def
down
with_lock_retries
do
drop_table
:required_code_owners_sections
,
if_exists:
true
end
end
end
db/schema_migrations/20200928131934
0 → 100644
View file @
9c4fb2ce
106757b0f30d3c89fcafa13be92271090fa107831fd538ee087d7ce212842492
\ No newline at end of file
db/structure.sql
View file @
9c4fb2ce
...
@@ -15448,6 +15448,22 @@ CREATE TABLE repository_languages (
...
@@ -15448,6 +15448,22 @@ CREATE TABLE repository_languages (
share
double
precision
NOT
NULL
share
double
precision
NOT
NULL
);
);
CREATE
TABLE
required_code_owners_sections
(
id
bigint
NOT
NULL
,
protected_branch_id
bigint
NOT
NULL
,
name
text
NOT
NULL
,
CONSTRAINT
check_e58d53741e
CHECK
((
char_length
(
name
)
<=
1024
))
);
CREATE
SEQUENCE
required_code_owners_sections_id_seq
START
WITH
1
INCREMENT
BY
1
NO
MINVALUE
NO
MAXVALUE
CACHE
1
;
ALTER
SEQUENCE
required_code_owners_sections_id_seq
OWNED
BY
required_code_owners_sections
.
id
;
CREATE
TABLE
requirements
(
CREATE
TABLE
requirements
(
id
bigint
NOT
NULL
,
id
bigint
NOT
NULL
,
created_at
timestamp
with
time
zone
NOT
NULL
,
created_at
timestamp
with
time
zone
NOT
NULL
,
...
@@ -17746,6 +17762,8 @@ ALTER TABLE ONLY releases ALTER COLUMN id SET DEFAULT nextval('releases_id_seq':
...
@@ -17746,6 +17762,8 @@ ALTER TABLE ONLY releases ALTER COLUMN id SET DEFAULT nextval('releases_id_seq':
ALTER
TABLE
ONLY
remote_mirrors
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'remote_mirrors_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
remote_mirrors
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'remote_mirrors_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
required_code_owners_sections
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'required_code_owners_sections_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
requirements
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'requirements_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
requirements
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'requirements_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
requirements_management_test_reports
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'requirements_management_test_reports_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
requirements_management_test_reports
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'requirements_management_test_reports_id_seq'
::
regclass
);
...
@@ -19027,6 +19045,9 @@ ALTER TABLE ONLY releases
...
@@ -19027,6 +19045,9 @@ ALTER TABLE ONLY releases
ALTER
TABLE
ONLY
remote_mirrors
ALTER
TABLE
ONLY
remote_mirrors
ADD
CONSTRAINT
remote_mirrors_pkey
PRIMARY
KEY
(
id
);
ADD
CONSTRAINT
remote_mirrors_pkey
PRIMARY
KEY
(
id
);
ALTER
TABLE
ONLY
required_code_owners_sections
ADD
CONSTRAINT
required_code_owners_sections_pkey
PRIMARY
KEY
(
id
);
ALTER
TABLE
ONLY
requirements_management_test_reports
ALTER
TABLE
ONLY
requirements_management_test_reports
ADD
CONSTRAINT
requirements_management_test_reports_pkey
PRIMARY
KEY
(
id
);
ADD
CONSTRAINT
requirements_management_test_reports_pkey
PRIMARY
KEY
(
id
);
...
@@ -21202,6 +21223,8 @@ CREATE INDEX index_remote_mirrors_on_project_id ON remote_mirrors USING btree (p
...
@@ -21202,6 +21223,8 @@ CREATE INDEX index_remote_mirrors_on_project_id ON remote_mirrors USING btree (p
CREATE
UNIQUE
INDEX
index_repository_languages_on_project_and_languages_id
ON
repository_languages
USING
btree
(
project_id
,
programming_language_id
);
CREATE
UNIQUE
INDEX
index_repository_languages_on_project_and_languages_id
ON
repository_languages
USING
btree
(
project_id
,
programming_language_id
);
CREATE
INDEX
index_required_code_owners_sections_on_protected_branch_id
ON
required_code_owners_sections
USING
btree
(
protected_branch_id
);
CREATE
INDEX
index_requirements_management_test_reports_on_author_id
ON
requirements_management_test_reports
USING
btree
(
author_id
);
CREATE
INDEX
index_requirements_management_test_reports_on_author_id
ON
requirements_management_test_reports
USING
btree
(
author_id
);
CREATE
INDEX
index_requirements_management_test_reports_on_build_id
ON
requirements_management_test_reports
USING
btree
(
build_id
);
CREATE
INDEX
index_requirements_management_test_reports_on_build_id
ON
requirements_management_test_reports
USING
btree
(
build_id
);
...
@@ -23299,6 +23322,9 @@ ALTER TABLE ONLY clusters_kubernetes_namespaces
...
@@ -23299,6 +23322,9 @@ ALTER TABLE ONLY clusters_kubernetes_namespaces
ALTER
TABLE
ONLY
approval_merge_request_rules_users
ALTER
TABLE
ONLY
approval_merge_request_rules_users
ADD
CONSTRAINT
fk_rails_80e6801803
FOREIGN
KEY
(
approval_merge_request_rule_id
)
REFERENCES
approval_merge_request_rules
(
id
)
ON
DELETE
CASCADE
;
ADD
CONSTRAINT
fk_rails_80e6801803
FOREIGN
KEY
(
approval_merge_request_rule_id
)
REFERENCES
approval_merge_request_rules
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
required_code_owners_sections
ADD
CONSTRAINT
fk_rails_817708cf2d
FOREIGN
KEY
(
protected_branch_id
)
REFERENCES
protected_branches
(
id
)
ON
DELETE
CASCADE
;
ALTER
TABLE
ONLY
dast_site_profiles
ALTER
TABLE
ONLY
dast_site_profiles
ADD
CONSTRAINT
fk_rails_83e309d69e
FOREIGN
KEY
(
project_id
)
REFERENCES
projects
(
id
)
ON
DELETE
CASCADE
;
ADD
CONSTRAINT
fk_rails_83e309d69e
FOREIGN
KEY
(
project_id
)
REFERENCES
projects
(
id
)
ON
DELETE
CASCADE
;
...
...
ee/app/models/concerns/ee/protected_branch.rb
View file @
9c4fb2ce
...
@@ -7,6 +7,8 @@ module EE
...
@@ -7,6 +7,8 @@ module EE
prepended
do
prepended
do
has_and_belongs_to_many
:approval_project_rules
has_and_belongs_to_many
:approval_project_rules
has_many
:required_code_owners_sections
,
class_name:
"ProtectedBranch::RequiredCodeOwnersSection"
protected_ref_access_levels
:unprotect
protected_ref_access_levels
:unprotect
end
end
...
...
ee/app/models/protected_branch/required_code_owners_section.rb
0 → 100644
View file @
9c4fb2ce
# frozen_string_literal: true
class
ProtectedBranch::RequiredCodeOwnersSection
<
ApplicationRecord
self
.
table_name
=
'required_code_owners_sections'
belongs_to
:protected_branch
end
ee/spec/models/ee/protected_branch_spec.rb
View file @
9c4fb2ce
...
@@ -8,6 +8,10 @@ RSpec.describe ProtectedBranch do
...
@@ -8,6 +8,10 @@ RSpec.describe ProtectedBranch do
let
(
:project
)
{
subject
.
project
}
let
(
:project
)
{
subject
.
project
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
'associations'
do
it
{
is_expected
.
to
have_many
(
:required_code_owners_sections
).
class_name
(
'ProtectedBranch::RequiredCodeOwnersSection'
)
}
end
shared_examples
'uniqueness validation'
do
|
access_level_class
|
shared_examples
'uniqueness validation'
do
|
access_level_class
|
let
(
:factory_name
)
{
access_level_class
.
to_s
.
underscore
.
sub
(
'/'
,
'_'
).
to_sym
}
let
(
:factory_name
)
{
access_level_class
.
to_s
.
underscore
.
sub
(
'/'
,
'_'
).
to_sym
}
let
(
:association_name
)
{
access_level_class
.
to_s
.
underscore
.
sub
(
'protected_branch/'
,
''
).
pluralize
.
to_sym
}
let
(
:association_name
)
{
access_level_class
.
to_s
.
underscore
.
sub
(
'protected_branch/'
,
''
).
pluralize
.
to_sym
}
...
...
ee/spec/models/protected_branch/required_code_owners_section_spec.rb
0 → 100644
View file @
9c4fb2ce
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
ProtectedBranch
::
RequiredCodeOwnersSection
do
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:protected_branch
)
}
end
end
spec/lib/gitlab/import_export/all_models.yml
View file @
9c4fb2ce
...
@@ -304,6 +304,7 @@ protected_branches:
...
@@ -304,6 +304,7 @@ protected_branches:
-
push_access_levels
-
push_access_levels
-
unprotect_access_levels
-
unprotect_access_levels
-
approval_project_rules
-
approval_project_rules
-
required_code_owners_sections
protected_tags
:
protected_tags
:
-
project
-
project
-
create_access_levels
-
create_access_levels
...
...
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