Sha256: af460a4687e23aad117130bff33770607d117cb30b07bbbdbdbfde880fcad00e
Contents?: true
Size: 448 Bytes
Versions: 27
Compression:
Stored size: 448 Bytes
Contents
class RemoveDuplicateServices2 < 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