BigW Consortium Gitlab

20140914145549_migrate_to_new_members_model.rb 553 Bytes
Newer Older
1 2
class MigrateToNewMembersModel < ActiveRecord::Migration
  def up
3
    execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, group_id, 'Namespace', group_access, notification_level, 'GroupMember' FROM users_groups"
4 5 6 7 8 9 10 11
    execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, project_id, 'Project', project_access, notification_level, 'ProjectMember' FROM users_projects"
  end

  def down
    Member.delete_all
  end
end