18 lines
819 B
MySQL
18 lines
819 B
MySQL
|
|
-- 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);
|