Convert refresh_tokens.token from VARCHAR to UUID

- Change token column type from VARCHAR(255) to UUID
- Add gen_random_uuid() as default value for token
- Improves type safety and performance for token storage
This commit is contained in:
2026-01-31 11:44:23 -05:00
parent 45ba922c68
commit 835e78898a
+1 -1
View File
@@ -36,7 +36,7 @@ CREATE TABLE users (
CREATE TABLE refresh_tokens (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
token VARCHAR(255) UNIQUE NOT NULL,
token UUID UNIQUE NOT NULL DEFAULT gen_random_uuid(),
expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
revoked_at TIMESTAMP WITH TIME ZONE