-- Add note_versions table CREATE TABLE note_versions ( id TEXT PRIMARY KEY, note_id TEXT NOT NULL, title TEXT NOT NULL, content TEXT NOT NULL, created_at TEXT NOT NULL, FOREIGN KEY(note_id) REFERENCES notes(id) ON DELETE CASCADE ); CREATE INDEX idx_note_versions_note_id ON note_versions(note_id);