Sha256: f7593ba4f9947eb0cc8926d5aab193e4bd544a1394fad5b52f1756336782d917
Contents?: true
Size: 340 Bytes
Versions: 5
Compression:
Stored size: 340 Bytes
Contents
class AddIndexForPath < ActiveRecord::Migration def self.up shares = Gitdocs::Configuration::Share.all.reduce(Hash.new { |h, k| h[k] = [] }) { |h, s| h[s.path] << s; h } shares.each do |path, shares| shares.shift shares.each(&:destroy) unless shares.empty? end add_index :shares, :path, unique: true end end
Version data entries
5 entries across 5 versions & 1 rubygems