Sha256: e1de748d87d7db0422154c0b00c04777894ae8e3b9fc4d60c6a5645ea330509a
Contents?: true
Size: 447 Bytes
Versions: 27
Compression:
Stored size: 447 Bytes
Contents
class RemoveDuplicateServices < ActiveRecord::Migration def change select_mgr = Mdm::Service.arel_table.project( Mdm::Service[:host_id], Mdm::Service[:proto], Mdm::Service[:port].count ).group( 'host_id', 'port', 'proto' ).having(Mdm::Service[:port].count.gt(1)) Mdm::Service.find_by_sql(select_mgr).each(&:destroy) add_index :services, [:host_id, :port, :proto], unique: true end end
Version data entries
27 entries across 27 versions & 1 rubygems