You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/db/migrate/20190120063702_sync_reponam...

17 lines
466 B

class SyncReponame < ActiveRecord::Migration[5.2]
def change
g = Gitlab.client
myshixuns = Myshixun.where("repo_name is null")
myshixuns.find_each do |myshixun|
begin
puts myshixun.id
repo_name = g.project(myshixun.gpid).path_with_namespace
puts repo_name
myshixun.update_column(:repo_name, repo_name)
rescue Exception => e
Rails.logger.error("e.message")
end
end
end
end