Created
June 26, 2017 08:29
-
-
Save odlp/08a42dbfacef5dbfeacb6e699c867c34 to your computer and use it in GitHub Desktop.
Case-insensitive unique constraint in Postgres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UniqueUserEmail < ActiveRecord::Migration[5.1] | |
def change | |
enable_extension :citext | |
change_column :users, :email, :citext | |
add_index :users, :email, unique: true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment