CREATE TABLE user_sessions(
    "id" serial primary key not null,
    "index_id" bigserial not null,
    "username" varchar not null references "users"("username") not null,
    "refresh_token" varchar not null,
    "user_agent" varchar not null,
    "client_ip" varchar not null,
    "is_blocked" boolean not null default false,
    "expires_at" timestamp not null,
    "created_at" timestamp default(now())
);

CREATE INDEX ON "user_sessions"("index_id");
