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
61bfd65f
Commit
61bfd65f
authored
Oct 12, 2021
by
Zhu Shung
Committed by
Andreas Brandl
Oct 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add phone to user_details and create verification_codes
parent
f21f76b8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
111 additions
and
0 deletions
+111
-0
db/migrate/20210929025600_add_phone_to_user_details.rb
db/migrate/20210929025600_add_phone_to_user_details.rb
+15
-0
db/migrate/20210929030834_add_text_limit_to_user_details_phone.rb
...te/20210929030834_add_text_limit_to_user_details_phone.rb
+13
-0
db/migrate/20210929031049_add_unique_index_phone_on_user_details.rb
.../20210929031049_add_unique_index_phone_on_user_details.rb
+15
-0
db/migrate/20210929032555_create_verification_codes.rb
db/migrate/20210929032555_create_verification_codes.rb
+36
-0
db/schema_migrations/20210929025600
db/schema_migrations/20210929025600
+1
-0
db/schema_migrations/20210929030834
db/schema_migrations/20210929030834
+1
-0
db/schema_migrations/20210929031049
db/schema_migrations/20210929031049
+1
-0
db/schema_migrations/20210929032555
db/schema_migrations/20210929032555
+1
-0
db/structure.sql
db/structure.sql
+28
-0
No files found.
db/migrate/20210929025600_add_phone_to_user_details.rb
0 → 100644
View file @
61bfd65f
# frozen_string_literal: true
class
AddPhoneToUserDetails
<
Gitlab
::
Database
::
Migration
[
1.0
]
enable_lock_retries!
# rubocop:disable Migration/AddLimitToTextColumns
def
up
add_column
:user_details
,
:phone
,
:text
,
comment:
'JiHu-specific column'
end
# rubocop:enable Migration/AddLimitToTextColumns
def
down
remove_column
:user_details
,
:phone
end
end
db/migrate/20210929030834_add_text_limit_to_user_details_phone.rb
0 → 100644
View file @
61bfd65f
# frozen_string_literal: true
class
AddTextLimitToUserDetailsPhone
<
Gitlab
::
Database
::
Migration
[
1.0
]
disable_ddl_transaction!
def
up
add_text_limit
:user_details
,
:phone
,
32
end
def
down
remove_text_limit
:user_details
,
:phone
end
end
db/migrate/20210929031049_add_unique_index_phone_on_user_details.rb
0 → 100644
View file @
61bfd65f
# frozen_string_literal: true
class
AddUniqueIndexPhoneOnUserDetails
<
Gitlab
::
Database
::
Migration
[
1.0
]
disable_ddl_transaction!
INDEX_NAME
=
'index_user_details_on_phone'
def
up
add_concurrent_index
:user_details
,
:phone
,
unique:
true
,
where:
'phone IS NOT NULL'
,
name:
INDEX_NAME
,
comment:
'JiHu-specific index'
end
def
down
remove_concurrent_index_by_name
:user_details
,
INDEX_NAME
end
end
db/migrate/20210929032555_create_verification_codes.rb
0 → 100644
View file @
61bfd65f
# frozen_string_literal: true
class
CreateVerificationCodes
<
Gitlab
::
Database
::
Migration
[
1.0
]
include
Gitlab
::
Database
::
PartitioningMigrationHelpers
::
TableManagementHelpers
def
up
constraint_visitor_id_code
=
check_constraint_name
(
'verification_codes'
,
'visitor_id_code'
,
'max_length'
)
constraint_code
=
check_constraint_name
(
'verification_codes'
,
'code'
,
'max_length'
)
constraint_phone
=
check_constraint_name
(
'verification_codes'
,
'phone'
,
'max_length'
)
execute
(
<<~
SQL
)
CREATE TABLE verification_codes (
created_at timestamp with time zone NOT NULL DEFAULT NOW(),
visitor_id_code text,
code text,
phone text,
PRIMARY KEY (created_at, visitor_id_code, code, phone),
CONSTRAINT
#{
constraint_visitor_id_code
}
CHECK ((char_length(visitor_id_code) <= 64)),
CONSTRAINT
#{
constraint_code
}
CHECK ((char_length(code) <= 8)),
CONSTRAINT
#{
constraint_phone
}
CHECK ((char_length(phone) <= 32))
) PARTITION BY RANGE (created_at);
COMMENT ON TABLE verification_codes IS 'JiHu-specific table';
CREATE UNIQUE INDEX index_verification_codes_on_phone_and_visitor_id_code ON verification_codes (visitor_id_code, phone, created_at);
COMMENT ON INDEX index_verification_codes_on_phone_and_visitor_id_code IS 'JiHu-specific index';
SQL
min_date
=
Date
.
today
-
1
.
month
max_date
=
Date
.
today
+
1
.
month
create_daterange_partitions
(
'verification_codes'
,
'created_at'
,
min_date
,
max_date
)
end
def
down
drop_table
:verification_codes
end
end
db/schema_migrations/20210929025600
0 → 100644
View file @
61bfd65f
c757a7e17433b8ddf15ae6304286fe3da69f820966455e7fbed7282286f5eb67
\ No newline at end of file
db/schema_migrations/20210929030834
0 → 100644
View file @
61bfd65f
b5302b3a2384bd7d0e639f00941efb490c3121a9332f1e73be620ab0f6f3e771
\ No newline at end of file
db/schema_migrations/20210929031049
0 → 100644
View file @
61bfd65f
d3f588e4edded61f36acbf25fba39be17a2ac16f37e9114f2c5c257c47dc1308
\ No newline at end of file
db/schema_migrations/20210929032555
0 → 100644
View file @
61bfd65f
08593002910759482c58f9b31f251d589ab32b540d9614a2c677df11d32f7f26
\ No newline at end of file
db/structure.sql
View file @
61bfd65f
...
...
@@ -19851,12 +19851,16 @@ CREATE TABLE user_details (
pronouns text,
pronunciation text,
registration_objective smallint,
phone text,
CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)),
CONSTRAINT check_a73b398c60 CHECK ((char_length(phone) <= 32)),
CONSTRAINT check_b132136b01 CHECK ((char_length(other_role) <= 100)),
CONSTRAINT check_eeeaf8d4f0 CHECK ((char_length(pronouns) <= 50)),
CONSTRAINT check_f932ed37db CHECK ((char_length(pronunciation) <= 255))
);
COMMENT ON COLUMN user_details.phone IS 'JiHu-specific column';
CREATE SEQUENCE user_details_user_id_seq
START WITH 1
INCREMENT BY 1
...
...
@@ -20150,6 +20154,19 @@ CREATE SEQUENCE users_statistics_id_seq
ALTER SEQUENCE users_statistics_id_seq OWNED BY users_statistics.id;
CREATE TABLE verification_codes (
created_at timestamp with time zone DEFAULT now() NOT NULL,
visitor_id_code text NOT NULL,
code text NOT NULL,
phone text NOT NULL,
CONSTRAINT check_9b84e6aaff CHECK ((char_length(code) <= 8)),
CONSTRAINT check_ccc542256b CHECK ((char_length(visitor_id_code) <= 64)),
CONSTRAINT check_f5684c195b CHECK ((char_length(phone) <= 32))
)
PARTITION BY RANGE (created_at);
COMMENT ON TABLE verification_codes IS 'JiHu-specific table';
CREATE TABLE vulnerabilities (
id bigint NOT NULL,
milestone_id bigint,
...
...
@@ -23810,6 +23827,9 @@ ALTER TABLE ONLY users_star_projects
ALTER TABLE ONLY users_statistics
ADD CONSTRAINT users_statistics_pkey PRIMARY KEY (id);
ALTER TABLE ONLY verification_codes
ADD CONSTRAINT verification_codes_pkey PRIMARY KEY (created_at, visitor_id_code, code, phone);
ALTER TABLE ONLY vulnerabilities
ADD CONSTRAINT vulnerabilities_pkey PRIMARY KEY (id);
...
...
@@ -26764,6 +26784,10 @@ CREATE INDEX index_user_custom_attributes_on_key_and_value ON user_custom_attrib
CREATE UNIQUE INDEX index_user_custom_attributes_on_user_id_and_key ON user_custom_attributes USING btree (user_id, key);
CREATE UNIQUE INDEX index_user_details_on_phone ON user_details USING btree (phone) WHERE (phone IS NOT NULL);
COMMENT ON INDEX index_user_details_on_phone IS 'JiHu-specific index';
CREATE INDEX index_user_details_on_provisioned_by_group_id ON user_details USING btree (provisioned_by_group_id);
CREATE UNIQUE INDEX index_user_details_on_user_id ON user_details USING btree (user_id);
...
...
@@ -26846,6 +26870,10 @@ CREATE INDEX index_users_star_projects_on_project_id ON users_star_projects USIN
CREATE UNIQUE INDEX index_users_star_projects_on_user_id_and_project_id ON users_star_projects USING btree (user_id, project_id);
CREATE UNIQUE INDEX index_verification_codes_on_phone_and_visitor_id_code ON ONLY verification_codes USING btree (visitor_id_code, phone, created_at);
COMMENT ON INDEX index_verification_codes_on_phone_and_visitor_id_code IS 'JiHu-specific index';
CREATE UNIQUE INDEX index_vuln_historical_statistics_on_project_id_and_date ON vulnerability_historical_statistics USING btree (project_id, date);
CREATE INDEX index_vulnerabilities_on_author_id ON vulnerabilities USING btree (author_id);
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