diff --git a/db/migrate/20170922112450_sync_publish_game_for_gitlab.rb b/db/migrate/20170922112450_sync_publish_game_for_gitlab.rb new file mode 100644 index 000000000..e91a6cd12 --- /dev/null +++ b/db/migrate/20170922112450_sync_publish_game_for_gitlab.rb @@ -0,0 +1,22 @@ +class SyncPublishGameForGitlab < ActiveRecord::Migration + def up + begin + g = Gitlab.client + shixuns = Shixun.where(:status => 2) + shixuns.each do |shixun| + shixun.shixun_members.each do |member| + gid = User.find(member.user_id).try(:gid) + g.edit_team_member(shixun.gpid, gid, 10) # 3代表角色master + end + # 加入超级管理员 + admin_gid = User.where(:admin => 1).first.try(:gid) + g.add_team_member(shixun.gpid, admin_gid, 40) # 30代表角色master + end + rescue Exception => e + puts e.message + end + end + + def down + end +end