Rustelo/features/shared/migrations/004_gdpr_bookmarks_sqlite.sql
Jesús Pérez c0281e759c
chore: update
2026-07-18 20:14:32 +01:00

17 lines
819 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Migration: 004 GDPR consent timestamp + user bookmarks
-- Database: SQLite
ALTER TABLE users ADD COLUMN gdpr_accepted_at DATETIME;
CREATE TABLE IF NOT EXISTS user_bookmarks (
id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(4))) || '-' || lower(hex(randomblob(2))) || '-4' || substr(lower(hex(randomblob(2))),2) || '-' || substr('89ab',abs(random()) % 4 + 1, 1) || substr(lower(hex(randomblob(2))),2) || '-' || lower(hex(randomblob(6)))),
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
content_type TEXT NOT NULL,
content_id TEXT NOT NULL,
content_title TEXT,
content_url TEXT,
created_at DATETIME NOT NULL DEFAULT (datetime('now')),
UNIQUE(user_id, content_type, content_id)
);
CREATE INDEX IF NOT EXISTS idx_user_bookmarks_user_id ON user_bookmarks(user_id);