CREATE TABLE IF NOT EXISTS document_versions (
    id TEXT PRIMARY KEY,
    document_id TEXT NOT NULL,
    hash TEXT NOT NULL,
    previous_hash TEXT,
    created_at TEXT NOT NULL,
    change_summary TEXT,
    UNIQUE(document_id, hash),
    FOREIGN KEY(document_id) REFERENCES documents(id) ON DELETE CASCADE
);

