2017-08-31 00:06:56 -04:00
|
|
|
class AddIndexToTopicStatusUpdates < ActiveRecord::Migration[4.2]
|
2017-03-21 23:12:02 -04:00
|
|
|
def up
|
|
|
|
execute <<~SQL
|
|
|
|
CREATE UNIQUE INDEX idx_topic_id_status_type_deleted_at
|
|
|
|
ON topic_status_updates(topic_id, status_type)
|
|
|
|
WHERE deleted_at IS NULL
|
|
|
|
SQL
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
execute "DROP INDEX idx_topic_id_status_type_deleted_at"
|
|
|
|
end
|
|
|
|
end
|