Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
	
		
	
				
					
				
			
						commit
						070af9ad73
					
				@ -0,0 +1,5 @@
 | 
				
			||||
class AddIndexToSecdomain < ActiveRecord::Migration
 | 
				
			||||
  def change
 | 
				
			||||
    add_index(:secdomains, :subname, unique: true)
 | 
				
			||||
  end
 | 
				
			||||
end
 | 
				
			||||
@ -0,0 +1,14 @@
 | 
				
			||||
class MoveDomainToSecdomain < ActiveRecord::Migration
 | 
				
			||||
  def up
 | 
				
			||||
    Secdomain.transaction do
 | 
				
			||||
      #将组织中的子域名迁移至secdomains表
 | 
				
			||||
      Organization.where("domain is not null").each do |org|
 | 
				
			||||
        Secdomain.create(sub_type: 2,  subname: org.domain, pid: org.id)
 | 
				
			||||
      end
 | 
				
			||||
      #remove_column :organizations, :domain
 | 
				
			||||
    end
 | 
				
			||||
  end
 | 
				
			||||
 | 
				
			||||
  def down
 | 
				
			||||
  end
 | 
				
			||||
end
 | 
				
			||||
@ -0,0 +1,8 @@
 | 
				
			||||
class RemoveDomainFromOrganizations < ActiveRecord::Migration
 | 
				
			||||
  def up
 | 
				
			||||
    remove_column :organizations, :domain
 | 
				
			||||
  end
 | 
				
			||||
 | 
				
			||||
  def down
 | 
				
			||||
  end
 | 
				
			||||
end
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue