ALTER TABLE admins ADD CONSTRAINT uc_EmailandDeleted_at UNIQUE (email,deleted_at);
I have changed my table to work as this:
ID EMAIL DELETED_AT
1. user@example.com NULL <- accept
2. user@example.com NULL <- reject because of uniqueness.
But Its not working as I wish. If i gave two identical dates to
deleted_at
It is generating error as I expect. But not for NULL values. Any idea?
NB: I can’t change the behaviors of deleted_at column because I am using acts_as_paranoid. So I have to keep deleted_at field to be NULL or any date.
From the documentation:
The above excerpt from MySQL 5.0. MySQL dropped the BDB storage engine in 5.1.12.
So now from the latest documentation: