Sha256: 464f1ed0a61c88ae3a0fb5b379b1eb7955fdd344c966d83987401305bec8cf2f

Contents?: true

Size: 336 Bytes

Versions: 25

Compression:

Stored size: 336 Bytes

Contents

class AddIndexForPath < ActiveRecord::Migration
  def self.up
    shares = Gitdocs::Configuration::Share.all.inject(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

25 entries across 25 versions & 2 rubygems

Version Path
gitdocs-0.4.15 lib/gitdocs/migration/004_add_index_for_path.rb
siuying-gitdocs-0.4.16 lib/gitdocs/migration/004_add_index_for_path.rb
siuying-gitdocs-0.4.15 lib/gitdocs/migration/004_add_index_for_path.rb
siuying-gitdocs-0.4.14 lib/gitdocs/migration/004_add_index_for_path.rb
siuying-gitdocs-0.4.14.md lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.14 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.13 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.12 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.11 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.10 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.9 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.8 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.7 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.6 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.5 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.3 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.2 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.1 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.4.0 lib/gitdocs/migration/004_add_index_for_path.rb
gitdocs-0.3.6 lib/gitdocs/migration/004_add_index_for_path.rb