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
237e48a7
Commit
237e48a7
authored
Mar 29, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use SecureRandom.uuid over SecureRandom.urlsafe_base64
parent
8b4c08a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
8 deletions
+1
-8
db/migrate/20170328010804_add_uuid_to_application_settings.rb
...igrate/20170328010804_add_uuid_to_application_settings.rb
+1
-8
No files found.
db/migrate/20170328010804_add_uuid_to_application_settings.rb
View file @
237e48a7
...
...
@@ -8,18 +8,11 @@ class AddUuidToApplicationSettings < ActiveRecord::Migration
def
up
add_column
:application_settings
,
:uuid
,
:string
add_concurrent_index
:application_settings
,
:uuid
execute
(
"UPDATE application_settings SET uuid =
#{
quote
(
generate_random_string
(
40
)
)
}
"
)
execute
(
"UPDATE application_settings SET uuid =
#{
quote
(
SecureRandom
.
uuid
)
}
"
)
end
def
down
remove_index
:application_settings
,
:uuid
if
index_exists?
(
:application_settings
,
:uuid
)
remove_column
:application_settings
,
:uuid
end
private
def
generate_random_string
(
size
)
# urlsafe_base64 may return a string of size * 4/3
SecureRandom
.
urlsafe_base64
(
size
)[
0
,
size
]
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