create table user_blocking_settings (
    id bigint primary key not null,
    attempts_until_temp_ban bigint not null default 5,
    temp_ban_time varchar(10) default '00:30:00',
    attempts_until_perm_ban bigint not null default 5,
    enabled bool not null default false,
    temp_ban_enabled bool not null default false,
    perm_ban_enabled bool not null default false,
    created_at timestamptz not null,
    updated_at timestamptz
);

create sequence user_blocking_settings_id_seq;

alter table users add failed_logins_count bigint default 0;
alter table users add was_banned bool default false;
alter table users add blocked bool default false;
alter table users add blocked_until timestamptz;
update users set was_banned = false, failed_logins_count = 0, blocked = false;
