--- users-login

alter table users add login varchar2(255 char);

create unique index users_login_uniq
on users(
    case when 
        deleted = 0 
        and login is not null
        and login != ''
        then lower(login)
    end
);
