dev_partners
jingquan huang 6 years ago
parent e3af858ecc
commit c71677710d

@ -59,7 +59,9 @@ class WelcomeController < ApplicationController
# 同步镜像
if shixun.mirror_repositories.present?
shixun.mirror_repositories.each do |mirror|
LocalMirrorRepository.create!(:local_shixun_id => local_shixun.id, :mirror_repository_id => mirror.id)
# 本地版的mirror id和线上的可能不一样所以按名字取然后再存
# local_mirror = MirrorRepository.where(type_name: mirror.type_name).first.try(:id)
LocalMirrorRepository.create!(:local_shixun_id => local_shixun.id, :mirror_repository_id => mirror.id, type_name: mirror.type_name)
end
end
@ -124,7 +126,8 @@ class WelcomeController < ApplicationController
local_mirrors = LocalMirrorRepository.where(local_shixun_id: local_shixun.id)
if local_mirrors.present?
local_mirrors.each do |local_mirror|
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => local_mirror.mirror_repository_id)
local_mirror_new = MirrorRepository.where(type_name: local_mirror.try(:type_name)).first
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => local_mirror_new.id)
end
end

@ -0,0 +1,5 @@
class AddTypeNameToLocalMirrorRepositories < ActiveRecord::Migration
def change
add_column :local_mirror_repositories, :type_name, :string
end
end
Loading…
Cancel
Save