Commit 5ca1772385d6f67a16a12f134c707b471b23cbe8
1 parent
26622f4c
Exists in
master
and in
4 other branches
Init username migration and rake task for create appropriate namespace
Showing
2 changed files
with
18 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +namespace :gitlab do | ||
2 | + desc "GITLAB | Enable usernames and namespaces for user projects" | ||
3 | + task activate_namespaces: :environment do | ||
4 | + User.find_each(batch_size: 500) do |user| | ||
5 | + User.transaction do | ||
6 | + username = user.email.match(/^[^@]*/)[0] | ||
7 | + user.update_attributes!(username: username) | ||
8 | + user.create_namespace!(code: username, name: user.name) | ||
9 | + print '.'.green | ||
10 | + end | ||
11 | + end | ||
12 | + end | ||
13 | +end |