remove unique constraint on admin emails

This commit is contained in:
Christophe Robillard 2020-02-03 11:02:57 +01:00
parent 055918aabc
commit 7bb298722f
2 changed files with 15 additions and 2 deletions

View file

@ -0,0 +1,13 @@
class RemoveUniqueConstraintOnAdministrateurEmails < ActiveRecord::Migration[5.2]
def up
# Drop the index entirely
remove_index :administrateurs, :email
# Add the index again, without the unicity constraint
add_index :administrateurs, :email
end
def down
remove_index :administrateurs, :email
add_index :administrateurs, :email, unique: true
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_01_14_113700) do
ActiveRecord::Schema.define(version: 2020_01_30_165328) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -53,7 +53,7 @@ ActiveRecord::Schema.define(version: 2020_01_14_113700) do
t.datetime "updated_at"
t.boolean "active", default: false
t.string "encrypted_token"
t.index ["email"], name: "index_administrateurs_on_email", unique: true
t.index ["email"], name: "index_administrateurs_on_email"
end
create_table "administrateurs_instructeurs", id: false, force: :cascade do |t|