need those indexes
This commit is contained in:
parent
1b94fcc84f
commit
3e0deaef67
1 changed files with 29 additions and 0 deletions
29
db/migrate/20091011222125_add_indexes.rb
Normal file
29
db/migrate/20091011222125_add_indexes.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
class AddIndexes < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :albums, :id, :unique => true
|
||||
add_index :collections, :id, :unique => true
|
||||
add_index :photos, :id, :unique => true
|
||||
add_index :tags, :id, :unique => true
|
||||
|
||||
add_index :collection_albums, :collection_id
|
||||
add_index :collection_albums, :album_id
|
||||
add_index :photos, :album_id
|
||||
add_index :photos, :photo_id
|
||||
add_index :photo_tags, :tag_id
|
||||
add_index :photo_tags, :photo_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :albums, :id
|
||||
remove_index :collections, :id
|
||||
remove_index :photos, :id
|
||||
remove_index :tags, :id
|
||||
|
||||
remove_index :collection_albums, :collection_id
|
||||
remove_index :collection_albums, :album_id
|
||||
remove_index :photos, :album_id
|
||||
remove_index :photos, :photo_id
|
||||
remove_index :photo_tags, :tag_id
|
||||
remove_index :photo_tags, :photo_id
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue