create table user_blocking_settings
(
    id                      BIGINT IDENTITY (1, 1) PRIMARY KEY,
    attempts_until_temp_ban bigint         not null default 5,
    temp_ban_time           nvarchar(10)            default '00:30:00',
    attempts_until_perm_ban bigint         not null default 5,
    enabled                 bit            not null default 0,
    temp_ban_enabled        bit            not null default 0,
    perm_ban_enabled        bit            not null default 0,
    created_at              DATETIMEOFFSET not null,
    updated_at              DATETIMEOFFSET
);

alter table users
    add failed_logins_count bigint default 0;
alter table users
    add was_banned bit default 0;
alter table users
    add blocked bit default 0;
alter table users
    add blocked_until DATETIMEOFFSET;
update users
set failed_logins_count = 0,
    was_banned          = 0,
    blocked             = 0;
