I have a User table in my database.
The user has a field name, company_id and status: boolean, 1- live, 0- deleted.
When a user is deleted, his status is 0.
The combination of a live username in a company must be unique. After the user is deleted, I do not mind that the user was created with the same name for the company.
My question is how to define the uniuqe restriction for the field name, company_id and status = 1 (this is not a uniuqe restriction in these three areas, because I do not mind that the combination name-company_id-0 will be displayed several times in the table).
Thanks,
The yard
Dvora source share