-- Short art-history annotations on painting detail (with optional image markers) CREATE TABLE IF NOT EXISTS painting_annotations ( id SERIAL PRIMARY KEY, painting_id INTEGER NOT NULL REFERENCES paintings(id) ON DELETE CASCADE, label VARCHAR(80), body TEXT NOT NULL, category VARCHAR(30) NOT NULL DEFAULT 'subject', pos_x NUMERIC(5, 2), pos_y NUMERIC(5, 2), source_author VARCHAR(200), source VARCHAR(500), source_url VARCHAR(500), sort_order INTEGER NOT NULL DEFAULT 0, confidence VARCHAR(20) NOT NULL DEFAULT 'curated' ); CREATE INDEX IF NOT EXISTS painting_annotations_painting_idx ON painting_annotations (painting_id);