BEGIN; CREATE TABLE article_images ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), article_id UUID NOT NULL REFERENCES articles(id), image_path TEXT NOT NULL CHECK (length(trim(image_path)) > 0), visible BOOLEAN NOT NULL DEFAULT TRUE, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE(article_id, image_path) ); COMMIT;