Migrations: - 016, 017, 019: Replace gen_random_uuid() with uuid_generate_v7() - All UUID tables now use custom uuid_generate_v7() function Backend: - Create internal/utils/uuid/uuid.go with V7() function (RFC 9562) - Update storage_handler.go to use internal uuid.V7() - Remove dependency on google/uuid for file naming All new UUIDs in the system are now UUID v7 (time-ordered)
14 lines
571 B
SQL
14 lines
571 B
SQL
CREATE TABLE IF NOT EXISTS notifications (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v7(),
|
|
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
type VARCHAR(50) NOT NULL, -- info, success, warning, error
|
|
title VARCHAR(255) NOT NULL,
|
|
message TEXT NOT NULL,
|
|
link TEXT,
|
|
read_at TIMESTAMP,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE INDEX idx_notifications_user_id ON notifications(user_id);
|
|
CREATE INDEX idx_notifications_created_at ON notifications(created_at);
|