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
00831200
Commit
00831200
authored
Jun 05, 2020
by
Etienne Baqué
Committed by
Adam Hegyi
Jun 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added group_deploy_keys table
Added migration, updated schema. Created Model class.
parent
f5df1117
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
0 deletions
+102
-0
app/models/group_deploy_key.rb
app/models/group_deploy_key.rb
+11
-0
db/migrate/20200430174637_create_group_deploy_keys.rb
db/migrate/20200430174637_create_group_deploy_keys.rb
+36
-0
db/structure.sql
db/structure.sql
+40
-0
spec/factories/keys.rb
spec/factories/keys.rb
+4
-0
spec/models/group_deploy_key_spec.rb
spec/models/group_deploy_key_spec.rb
+11
-0
No files found.
app/models/group_deploy_key.rb
0 → 100644
View file @
00831200
# frozen_string_literal: true
class
GroupDeployKey
<
Key
self
.
table_name
=
'group_deploy_keys'
validates
:user
,
presence:
true
def
type
'DeployKey'
end
end
db/migrate/20200430174637_create_group_deploy_keys.rb
0 → 100644
View file @
00831200
# frozen_string_literal: true
class
CreateGroupDeployKeys
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
unless
table_exists?
(
:group_deploy_keys
)
with_lock_retries
do
create_table
:group_deploy_keys
do
|
t
|
t
.
references
:user
,
foreign_key:
{
on_delete: :restrict
},
index:
true
t
.
timestamps_with_timezone
t
.
datetime_with_timezone
:last_used_at
t
.
datetime_with_timezone
:expires_at
t
.
text
:key
,
null:
false
,
unique:
true
t
.
text
:title
t
.
text
:fingerprint
,
null:
false
,
unique:
true
t
.
binary
:fingerprint_sha256
t
.
index
:fingerprint
,
unique:
true
t
.
index
:fingerprint_sha256
end
end
end
add_text_limit
(
:group_deploy_keys
,
:key
,
4096
)
add_text_limit
(
:group_deploy_keys
,
:title
,
255
)
add_text_limit
(
:group_deploy_keys
,
:fingerprint
,
255
)
end
def
down
drop_table
:group_deploy_keys
end
end
db/structure.sql
View file @
00831200
...
@@ -3146,6 +3146,31 @@ CREATE TABLE public.group_deletion_schedules (
...
@@ -3146,6 +3146,31 @@ CREATE TABLE public.group_deletion_schedules (
marked_for_deletion_on
date
NOT
NULL
marked_for_deletion_on
date
NOT
NULL
);
);
CREATE
TABLE
public
.
group_deploy_keys
(
id
bigint
NOT
NULL
,
user_id
bigint
,
created_at
timestamp
with
time
zone
NOT
NULL
,
updated_at
timestamp
with
time
zone
NOT
NULL
,
last_used_at
timestamp
with
time
zone
,
expires_at
timestamp
with
time
zone
,
key
text
NOT
NULL
,
title
text
,
fingerprint
text
NOT
NULL
,
fingerprint_sha256
bytea
,
CONSTRAINT
check_cc0365908d
CHECK
((
char_length
(
title
)
<=
255
)),
CONSTRAINT
check_e4526dcf91
CHECK
((
char_length
(
fingerprint
)
<=
255
)),
CONSTRAINT
check_f58fa0a0f7
CHECK
((
char_length
(
key
)
<=
4096
))
);
CREATE
SEQUENCE
public
.
group_deploy_keys_id_seq
START
WITH
1
INCREMENT
BY
1
NO
MINVALUE
NO
MAXVALUE
CACHE
1
;
ALTER
SEQUENCE
public
.
group_deploy_keys_id_seq
OWNED
BY
public
.
group_deploy_keys
.
id
;
CREATE
TABLE
public
.
group_deploy_tokens
(
CREATE
TABLE
public
.
group_deploy_tokens
(
id
bigint
NOT
NULL
,
id
bigint
NOT
NULL
,
created_at
timestamp
with
time
zone
NOT
NULL
,
created_at
timestamp
with
time
zone
NOT
NULL
,
...
@@ -7649,6 +7674,8 @@ ALTER TABLE ONLY public.grafana_integrations ALTER COLUMN id SET DEFAULT nextval
...
@@ -7649,6 +7674,8 @@ ALTER TABLE ONLY public.grafana_integrations ALTER COLUMN id SET DEFAULT nextval
ALTER
TABLE
ONLY
public
.
group_custom_attributes
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'public.group_custom_attributes_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
public
.
group_custom_attributes
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'public.group_custom_attributes_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
public
.
group_deploy_keys
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'public.group_deploy_keys_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
public
.
group_deploy_tokens
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'public.group_deploy_tokens_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
public
.
group_deploy_tokens
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'public.group_deploy_tokens_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
public
.
group_group_links
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'public.group_group_links_id_seq'
::
regclass
);
ALTER
TABLE
ONLY
public
.
group_group_links
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'public.group_group_links_id_seq'
::
regclass
);
...
@@ -8448,6 +8475,9 @@ ALTER TABLE ONLY public.group_custom_attributes
...
@@ -8448,6 +8475,9 @@ ALTER TABLE ONLY public.group_custom_attributes
ALTER
TABLE
ONLY
public
.
group_deletion_schedules
ALTER
TABLE
ONLY
public
.
group_deletion_schedules
ADD
CONSTRAINT
group_deletion_schedules_pkey
PRIMARY
KEY
(
group_id
);
ADD
CONSTRAINT
group_deletion_schedules_pkey
PRIMARY
KEY
(
group_id
);
ALTER
TABLE
ONLY
public
.
group_deploy_keys
ADD
CONSTRAINT
group_deploy_keys_pkey
PRIMARY
KEY
(
id
);
ALTER
TABLE
ONLY
public
.
group_deploy_tokens
ALTER
TABLE
ONLY
public
.
group_deploy_tokens
ADD
CONSTRAINT
group_deploy_tokens_pkey
PRIMARY
KEY
(
id
);
ADD
CONSTRAINT
group_deploy_tokens_pkey
PRIMARY
KEY
(
id
);
...
@@ -9890,6 +9920,12 @@ CREATE INDEX index_group_deletion_schedules_on_marked_for_deletion_on ON public.
...
@@ -9890,6 +9920,12 @@ CREATE INDEX index_group_deletion_schedules_on_marked_for_deletion_on ON public.
CREATE
INDEX
index_group_deletion_schedules_on_user_id
ON
public
.
group_deletion_schedules
USING
btree
(
user_id
);
CREATE
INDEX
index_group_deletion_schedules_on_user_id
ON
public
.
group_deletion_schedules
USING
btree
(
user_id
);
CREATE
UNIQUE
INDEX
index_group_deploy_keys_on_fingerprint
ON
public
.
group_deploy_keys
USING
btree
(
fingerprint
);
CREATE
INDEX
index_group_deploy_keys_on_fingerprint_sha256
ON
public
.
group_deploy_keys
USING
btree
(
fingerprint_sha256
);
CREATE
INDEX
index_group_deploy_keys_on_user_id
ON
public
.
group_deploy_keys
USING
btree
(
user_id
);
CREATE
INDEX
index_group_deploy_tokens_on_deploy_token_id
ON
public
.
group_deploy_tokens
USING
btree
(
deploy_token_id
);
CREATE
INDEX
index_group_deploy_tokens_on_deploy_token_id
ON
public
.
group_deploy_tokens
USING
btree
(
deploy_token_id
);
CREATE
UNIQUE
INDEX
index_group_deploy_tokens_on_group_and_deploy_token_ids
ON
public
.
group_deploy_tokens
USING
btree
(
group_id
,
deploy_token_id
);
CREATE
UNIQUE
INDEX
index_group_deploy_tokens_on_group_and_deploy_token_ids
ON
public
.
group_deploy_tokens
USING
btree
(
group_id
,
deploy_token_id
);
...
@@ -12114,6 +12150,9 @@ ALTER TABLE ONLY public.clusters_applications_knative
...
@@ -12114,6 +12150,9 @@ ALTER TABLE ONLY public.clusters_applications_knative
ALTER
TABLE
ONLY
public
.
terraform_states
ALTER
TABLE
ONLY
public
.
terraform_states
ADD
CONSTRAINT
fk_rails_558901b030
FOREIGN
KEY
(
locked_by_user_id
)
REFERENCES
public
.
users
(
id
);
ADD
CONSTRAINT
fk_rails_558901b030
FOREIGN
KEY
(
locked_by_user_id
)
REFERENCES
public
.
users
(
id
);
ALTER
TABLE
ONLY
public
.
group_deploy_keys
ADD
CONSTRAINT
fk_rails_5682fc07f8
FOREIGN
KEY
(
user_id
)
REFERENCES
public
.
users
(
id
)
ON
DELETE
RESTRICT
;
ALTER
TABLE
ONLY
public
.
issue_user_mentions
ALTER
TABLE
ONLY
public
.
issue_user_mentions
ADD
CONSTRAINT
fk_rails_57581fda73
FOREIGN
KEY
(
issue_id
)
REFERENCES
public
.
issues
(
id
)
ON
DELETE
CASCADE
;
ADD
CONSTRAINT
fk_rails_57581fda73
FOREIGN
KEY
(
issue_id
)
REFERENCES
public
.
issues
(
id
)
ON
DELETE
CASCADE
;
...
@@ -13750,6 +13789,7 @@ COPY "schema_migrations" (version) FROM STDIN;
...
@@ -13750,6 +13789,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200429182245
20200429182245
20200430103158
20200430103158
20200430130048
20200430130048
20200430174637
20200505164958
20200505164958
20200505171834
20200505171834
20200505172405
20200505172405
...
...
spec/factories/keys.rb
View file @
00831200
...
@@ -13,6 +13,10 @@ FactoryBot.define do
...
@@ -13,6 +13,10 @@ FactoryBot.define do
factory
:deploy_key
,
class:
'DeployKey'
factory
:deploy_key
,
class:
'DeployKey'
factory
:group_deploy_key
,
class:
'GroupDeployKey'
do
user
end
factory
:personal_key
do
factory
:personal_key
do
user
user
end
end
...
...
spec/models/group_deploy_key_spec.rb
0 → 100644
View file @
00831200
# frozen_string_literal: true
require
'spec_helper'
describe
GroupDeployKey
do
it
{
is_expected
.
to
validate_presence_of
(
:user
)
}
it
'is of type DeployKey'
do
expect
(
build
(
:group_deploy_key
).
type
).
to
eq
(
'DeployKey'
)
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