2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-30 23:06:56 -05:00
|
|
|
class RebuildDirectoryItemWithIndex < ActiveRecord::Migration[4.2]
|
2016-03-02 01:23:29 -06:00
|
|
|
def up
|
|
|
|
remove_index :directory_items, [:period_type]
|
|
|
|
execute "TRUNCATE TABLE directory_items RESTART IDENTITY"
|
2023-01-09 05:59:41 -06:00
|
|
|
add_index :directory_items, %i[period_type user_id], unique: true
|
2016-03-02 01:23:29 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
2023-01-09 05:59:41 -06:00
|
|
|
remove_index :directory_items, %i[period_type user_id]
|
2016-03-02 01:23:29 -06:00
|
|
|
add_index :directory_items, [:period_type]
|
|
|
|
end
|
|
|
|
end
|