Rustelo/resources/user-dashboard/migrations/004_gdpr_bookmarks_postgres.sql

18 lines
644 B
MySQL
Raw Normal View History

2026-07-18 20:16:16 +01:00
-- Migration: 004 GDPR consent timestamp + user bookmarks
-- Database: PostgreSQL
ALTER TABLE users ADD COLUMN IF NOT EXISTS gdpr_accepted_at TIMESTAMPTZ;
CREATE TABLE IF NOT EXISTS user_bookmarks (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
content_type VARCHAR(50) NOT NULL,
content_id VARCHAR(255) NOT NULL,
content_title VARCHAR(500),
content_url VARCHAR(500),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE(user_id, content_type, content_id)
);
CREATE INDEX IF NOT EXISTS idx_user_bookmarks_user_id ON user_bookmarks(user_id);