naise_pos/db/migrations/000002_create_sessions_table.up.sql

14 lines
476 B
MySQL
Raw Permalink Normal View History

2023-03-16 12:21:41 +07:00
CREATE TABLE user_sessions(
"id" uuid default gen_random_uuid() primary key not null,
"index_id" bigserial not null,
"email" varchar not null references "users"("email") 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");