2017-08-31 00:06:56 -04:00
|
|
|
class RebuildDirectoryItemWithIndex < ActiveRecord::Migration[4.2]
|
2016-03-02 02:23:29 -05:00
|
|
|
def up
|
|
|
|
remove_index :directory_items, [:period_type]
|
|
|
|
execute "TRUNCATE TABLE directory_items RESTART IDENTITY"
|
|
|
|
add_index :directory_items, [:period_type, :user_id], unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_index :directory_items, [:period_type, :user_id]
|
|
|
|
add_index :directory_items, [:period_type]
|
|
|
|
end
|
|
|
|
end
|