96 lines
2.8 KiB
Ruby
96 lines
2.8 KiB
Ruby
class AddIndexes < ActiveRecord::Migration
|
|
def up
|
|
# Artists
|
|
add_index :artists, :name
|
|
add_index :artists, :original_name
|
|
add_index :artists, :status
|
|
add_index :artists, :listeners
|
|
|
|
add_index :artist_aliases, :artist_id
|
|
add_index :artist_aliases, :name
|
|
|
|
add_index :artist_links, :artist_id
|
|
|
|
# Albums
|
|
add_index :albums, :name
|
|
add_index :albums, :artist_id
|
|
add_index :albums, :year
|
|
add_index :albums, :has_pic
|
|
add_index :albums, :master
|
|
|
|
add_index :release_formats, :hash
|
|
add_index :album_formats, :album_id
|
|
add_index :album_formats, :release_format_id
|
|
|
|
add_index :album_genres, :album_id
|
|
add_index :album_genres, :genre_id
|
|
|
|
add_index :album_styles, :album_id
|
|
add_index :album_styles, :style_id
|
|
|
|
# Tracks
|
|
add_index :tracks, :name
|
|
add_index :tracks, :album_id
|
|
add_index :tracks, :position
|
|
add_index :tracks, :bonus
|
|
|
|
add_index :track_artists, :track_id
|
|
add_index :track_artists, :artist_id
|
|
add_index :track_artists, :main
|
|
|
|
# Beathaven infrastructure
|
|
add_index :users, :name
|
|
add_index :users, :vkid
|
|
|
|
add_index :sessions, :user_id
|
|
add_index :sessions, :key
|
|
end
|
|
|
|
def down
|
|
# Artists
|
|
remove_index :artists, :column => :name
|
|
remove_index :artists, :column => :original_name
|
|
remove_index :artists, :column => :status
|
|
remove_index :artists, :column => :listeners
|
|
|
|
remove_index :artist_aliases, :column => :artist_id
|
|
remove_index :artist_aliases, :column => :name
|
|
|
|
remove_index :artist_links, :column => :artist_id
|
|
|
|
# Albums
|
|
remove_index :albums, :column => :name
|
|
remove_index :albums, :column => :artist_id
|
|
remove_index :albums, :column => :year
|
|
remove_index :albums, :column => :has_pic
|
|
remove_index :albums, :column => :master
|
|
|
|
remove_index :release_formats, :column => :hash
|
|
remove_index :album_formats, :column => :album_id
|
|
remove_index :album_formats, :column => :release_format_id
|
|
|
|
remove_index :album_genres, :column => :album_id
|
|
remove_index :album_genres, :column => :genre_id
|
|
|
|
remove_index :album_styles, :column => :album_id
|
|
remove_index :album_styles, :column => :style_id
|
|
|
|
# Tracks
|
|
remove_index :tracks, :column => :name
|
|
remove_index :tracks, :column => :album_id
|
|
remove_index :tracks, :column => :position
|
|
remove_index :tracks, :column => :bonus
|
|
|
|
remove_index :track_artists, :column => :track_id
|
|
remove_index :track_artists, :column => :artist_id
|
|
remove_index :track_artists, :column => :main
|
|
|
|
# Beathaven infrastructure
|
|
remove_index :users, :column => :name
|
|
remove_index :users, :column => :vkid
|
|
|
|
remove_index :sessions, :column => :user_id
|
|
remove_index :sessions, :column => :key
|
|
end
|
|
end
|