Sha256: 9216331f31824afafd5927e28b18abc9be6579bbd19e89998ab03b22792a1fce
Contents?: true
Size: 391 Bytes
Versions: 2
Compression:
Stored size: 391 Bytes
Contents
# -*- encoding : utf-8 -*- # rubocop:disable all 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gitdocs-0.5.0 | lib/gitdocs/migration/004_add_index_for_path.rb |
gitdocs-0.5.0.pre7 | lib/gitdocs/migration/004_add_index_for_path.rb |