hiling_go/db/migrations/000006_create_user_sessions_table.up.sql
2024-05-22 11:26:15 +07:00

14 lines
458 B
SQL
Executable File

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");