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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
5ca17723
Commit
5ca17723
authored
Nov 23, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Init username migration and rake task for create appropriate namespace
parent
26622f4c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
db/migrate/20121123104937_add_username_to_user.rb
db/migrate/20121123104937_add_username_to_user.rb
+5
-0
lib/tasks/gitlab/activate_namespaces.rake
lib/tasks/gitlab/activate_namespaces.rake
+13
-0
No files found.
db/migrate/20121123104937_add_username_to_user.rb
0 → 100644
View file @
5ca17723
class
AddUsernameToUser
<
ActiveRecord
::
Migration
def
change
add_column
:users
,
:username
,
:string
,
null:
true
end
end
lib/tasks/gitlab/activate_namespaces.rake
0 → 100644
View file @
5ca17723
namespace
:gitlab
do
desc
"GITLAB | Enable usernames and namespaces for user projects"
task
activate_namespaces: :environment
do
User
.
find_each
(
batch_size:
500
)
do
|
user
|
User
.
transaction
do
username
=
user
.
email
.
match
(
/^[^@]*/
)[
0
]
user
.
update_attributes!
(
username:
username
)
user
.
create_namespace!
(
code:
username
,
name:
user
.
name
)
print
'.'
.
green
end
end
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