Remove cascading deletes, add another foreign key, and switch index around.
[rails.git] / db / migrate / 048_add_diary_creation_indexes.rb
1 class AddDiaryCreationIndexes < ActiveRecord::Migration[5.0]
2   def self.up
3     add_index :diary_entries, [:created_at], :name => "diary_entry_created_at_index"
4     add_index :diary_entries, [:user_id, :created_at], :name => "diary_entry_user_id_created_at_index"
5     add_index :diary_entries, [:language_code, :created_at], :name => "diary_entry_language_code_created_at_index"
6   end
7
8   def self.down
9     remove_index :diary_entries, :name => "diary_entry_language_code_created_at_index"
10     remove_index :diary_entries, :name => "diary_entry_user_id_created_at_index"
11     remove_index :diary_entries, :name => "diary_entry_created_at_index"
12   end
13 end