Failed gitlab:enable_namespaces migration to 4.0
Created by: jasperla
It seems the upgrading instructions from 3.1 to 4.0 missing something, or I'm doing something wrong in the update.
Basically it comes down to this: The steps to migrate my database all succeed without errors, except for this step:
root@gitlab:/home/gitlab/gitlab# sudo -u gitlab -H bundle exec rake gitlab:enable_namespaces RAILS_ENV=production
Generate usernames for users without one:
rake aborted!
undefined method username' for #<User:0x00000004825a60> /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activemodel-3.2.11/lib/active_model/attribute_methods.rb:407:in
method_missing'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/attribute_methods.rb:149:in method_missing' /home/gitlab/gitlab/lib/tasks/gitlab/enable_namespaces.rake:24:in
block in migrate_user_namespaces'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:21:in block (2 levels) in find_each' /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:21:in
each'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:21:in block in find_each' /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:72:in
find_in_batches'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:20:in find_each' /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/querying.rb:8:in
find_each'
/home/gitlab/gitlab/lib/tasks/gitlab/enable_namespaces.rake:18:in migrate_user_namespaces' /home/gitlab/gitlab/lib/tasks/gitlab/enable_namespaces.rake:6:in
block (2 levels) in <top (required)>'
Tasks: TOP => gitlab:enable_namespaces
(See full trace by running task with --trace)
This in turn results in the following message in production.log:
Completed 500 Internal Server Error in 5ms
ActiveRecord::StatementInvalid (Mysql2::Error: Unknown column 'namespace_id' in 'field list': SELECT namespace_id FROM projects
INNER JOIN users_projects
ON projects
.id
= users_projects
.project_id
WHERE users_projects
.user_id
= 2):
config/initializers/connection_fix.rb:22:in execute' app/roles/account.rb:111:in
authorized_groups'
app/controllers/dashboard_controller.rb:8:in `index'
Am I missing something obvious?