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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user