Sha256: 09b70a710993d09639640b9742c130e5fcf842203a305728286bd0d6fbc36e65

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

class AddIndexes < ActiveRecord::Migration
  def self.up
    add_index Refinery::PhotoGallery::Album.table_name, :id, :unique => true
    add_index Refinery::PhotoGallery::Collection.table_name, :id, :unique => true
    add_index Refinery::PhotoGallery::Photo.table_name, :id, :unique => true


    add_index Refinery::PhotoGallery::CollectionAlbum.table_name, :collection_id, :name=>"index_rpg_collection_albums_on_collection_id"
    add_index Refinery::PhotoGallery::CollectionAlbum.table_name, :album_id, :name=>"index_rpg_collection_albums_on_album_id"
    add_index Refinery::PhotoGallery::Photo.table_name, :album_id
  end

  def self.down
    remove_index Refinery::PhotoGallery::Album.table_name, :id
    remove_index Refinery::PhotoGallery::Collection.table_name, :id
    remove_index Refinery::PhotoGallery::Photo.table_name, :id


    remove_index Refinery::PhotoGallery::CollectionAlbum.table_name, :collection_id
    remove_index Refinery::PhotoGallery::CollectionAlbum.table_name, :album_id
    remove_index Refinery::PhotoGallery::Photo.table_name, :album_id

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refinerycms-photo-gallery-0.2.0 db/migrate/20120805222125_add_indexes.rb