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
00eb49d0
Commit
00eb49d0
authored
Jun 26, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add simple data models
parent
b74defff
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
0 deletions
+65
-0
app/models/project.rb
app/models/project.rb
+3
-0
app/models/project_feature_flag.rb
app/models/project_feature_flag.rb
+12
-0
app/models/project_feature_flag_access_token.rb
app/models/project_feature_flag_access_token.rb
+10
-0
db/migrate/20180626171125_add_feature_flags_to_projects.rb
db/migrate/20180626171125_add_feature_flags_to_projects.rb
+31
-0
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+9
-0
No files found.
app/models/project.rb
View file @
00eb49d0
...
...
@@ -266,6 +266,9 @@ class Project < ActiveRecord::Base
has_many
:project_deploy_tokens
has_many
:deploy_tokens
,
through: :project_deploy_tokens
has_many
:project_feature_flags
has_many
:project_feature_flags_access_tokens
has_one
:auto_devops
,
class_name:
'ProjectAutoDevops'
has_many
:custom_attributes
,
class_name:
'ProjectCustomAttribute'
...
...
app/models/project_feature_flag.rb
0 → 100644
View file @
00eb49d0
class
ProjectFeatureFlag
<
ActiveRecord
::
Base
belongs_to
:project
validates
:project
,
presence:
true
validates
:name
,
presence:
true
,
length:
2
..
63
,
format:
{
with:
Gitlab
::
Regex
.
feature_flag_regex
,
message:
Gitlab
::
Regex
.
feature_flag_regex_message
}
end
app/models/project_feature_flag_access_token.rb
0 → 100644
View file @
00eb49d0
class
ProjectFeatureFlagAccessToken
<
ActiveRecord
::
Base
include
TokenAuthenticatable
belongs_to
:project
validates
:project
,
presence:
true
validates
:token
,
presence:
true
add_authentication_token_field
:token
end
db/migrate/20180626171125_add_feature_flags_to_projects.rb
0 → 100644
View file @
00eb49d0
class
AddFeatureFlagsToProjects
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
def
change
create_table
:project_feature_flags
do
|
t
|
t
.
integer
:project_id
,
null:
false
t
.
datetime_with_timezone
:created_at
,
null:
false
t
.
datetime_with_timezone
:updated_at
,
null:
false
t
.
string
:name
,
null:
false
t
.
text
:description
t
.
boolean
:active
,
null:
false
t
.
foreign_key
:projects
,
column: :project_id
,
on_delete: :cascade
t
.
index
[
:project_id
,
:name
],
unique:
true
end
create_table
:project_feature_flag_access_tokens
do
|
t
|
t
.
integer
:project_id
,
null:
false
t
.
string
:token
,
null:
false
t
.
index
[
:project_id
,
:token
],
unique:
true
,
name: :project_feature_flag_access_token
t
.
foreign_key
:projects
,
column: :project_id
,
on_delete: :cascade
end
end
end
lib/gitlab/regex.rb
View file @
00eb49d0
...
...
@@ -71,6 +71,15 @@ module Gitlab
"Must start with a letter, and cannot end with '-'"
end
def
feature_flag_regex
/\A[a-z]([-a-z0-9]*[a-z0-9])?\z/
end
def
feature_flag_regex_message
"can contain only lowercase letters, digits, '_' and '-'. "
\
"Must start with a letter, and cannot end with '-'"
end
def
build_trace_section_regex
@build_trace_section_regexp
||=
/section_((?:start)|(?:end)):(\d+):([a-zA-Z0-9_.-]+)\r\033\[0K/
.
freeze
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