Sha256: 00fbc2122457dc6e8df4752b67c8ba1738440cb2f23f3dfc10da3a11bac3a836

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

class AddIndexes < ActiveRecord::Migration[4.2]
  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.3.0 db/migrate/20120805222125_add_indexes.rb