mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 04:15:58 +08:00
12 lines
353 B
Ruby
12 lines
353 B
Ruby
|
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
|