2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-21 07:30:26 -05:00
|
|
|
class ChangeUserEmailsPrimaryIndex < ActiveRecord::Migration[5.1]
|
|
|
|
def up
|
|
|
|
remove_index :user_emails, [:user_id, :primary]
|
|
|
|
add_index :user_emails, [:user_id, :primary], unique: true, where: '"primary"'
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_index :user_emails, [:user_id, :primary]
|
|
|
|
add_index :user_emails, [:user_id, :primary], unique: true
|
|
|
|
end
|
|
|
|
end
|