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
299bc0b8
Commit
299bc0b8
authored
Mar 26, 2021
by
Emily Ring
Committed by
Dmitry Gruzd
Mar 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate null constraint for token name
parent
4ee871cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
4 deletions
+24
-4
app/models/clusters/agent_token.rb
app/models/clusters/agent_token.rb
+1
-1
changelogs/unreleased/322745-validate-null-constraint.yml
changelogs/unreleased/322745-validate-null-constraint.yml
+5
-0
db/post_migrate/20210317155207_validate_not_null_constraint_on_cluster_token_name.rb
...207_validate_not_null_constraint_on_cluster_token_name.rb
+16
-0
db/schema_migrations/20210317155207
db/schema_migrations/20210317155207
+1
-0
db/structure.sql
db/structure.sql
+1
-3
No files found.
app/models/clusters/agent_token.rb
View file @
299bc0b8
...
...
@@ -19,7 +19,7 @@ module Clusters
before_save
:ensure_token
validates
:description
,
length:
{
maximum:
1024
}
validates
:name
,
presence:
true
,
length:
{
maximum:
255
}
,
on: :create
validates
:name
,
presence:
true
,
length:
{
maximum:
255
}
def
track_usage
track_values
=
{
last_used_at:
Time
.
current
.
utc
}
...
...
changelogs/unreleased/322745-validate-null-constraint.yml
0 → 100644
View file @
299bc0b8
---
title
:
Validate
null
constraint for cluster token name
merge_request
:
56868
author
:
type
:
changed
db/post_migrate/20210317155207_validate_not_null_constraint_on_cluster_token_name.rb
0 → 100644
View file @
299bc0b8
# frozen_string_literal: true
class
ValidateNotNullConstraintOnClusterTokenName
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
validate_not_null_constraint
:cluster_agent_tokens
,
:name
end
def
down
# no-op
end
end
db/schema_migrations/20210317155207
0 → 100644
View file @
299bc0b8
b6c30723c2be7dd0afe535272cded230db4954bfe914d5087542be2c27d0ad79
\ No newline at end of file
db/structure.sql
View file @
299bc0b8
...
...
@@ -11199,6 +11199,7 @@ CREATE TABLE cluster_agent_tokens (
description text,
name text,
last_used_at timestamp with time zone,
CONSTRAINT check_0fb634d04d CHECK ((name IS NOT NULL)),
CONSTRAINT check_2b79dbb315 CHECK ((char_length(name) <= 255)),
CONSTRAINT check_4e4ec5070a CHECK ((char_length(description) <= 1024)),
CONSTRAINT check_c60daed227 CHECK ((char_length(token_encrypted) <= 255))
...
...
@@ -20211,9 +20212,6 @@ ALTER TABLE ONLY chat_names
ALTER TABLE ONLY chat_teams
ADD CONSTRAINT chat_teams_pkey PRIMARY KEY (id);
ALTER TABLE cluster_agent_tokens
ADD CONSTRAINT check_0fb634d04d CHECK ((name IS NOT NULL)) NOT VALID;
ALTER TABLE vulnerability_scanners
ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID;
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