UPDATE: database

This commit is contained in:
2026-03-24 00:00:44 +07:00
parent 3626c12319
commit eedd300861
18 changed files with 237 additions and 124 deletions

View File

@@ -0,0 +1,20 @@
CREATE TABLE IF NOT EXISTS user_tokens (
id UUID PRIMARY KEY DEFAULT uuidv7(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
token VARCHAR(255) NOT NULL UNIQUE,
token_type SMALLINT NOT NULL,
expires_at TIMESTAMPTZ NOT NULL,
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX idx_user_tokens_token
ON user_tokens(token);
CREATE INDEX idx_user_tokens_user_id
ON user_tokens(user_id);
CREATE INDEX idx_user_tokens_type
ON user_tokens(token_type);
CREATE INDEX idx_user_tokens_expires_at
ON user_tokens(expires_at);