-- Add chapters support to products table (for webinars) ALTER TABLE products ADD COLUMN IF NOT EXISTS chapters JSONB DEFAULT '[]'; -- Add chapters support to bootcamp_lessons table ALTER TABLE bootcamp_lessons ADD COLUMN IF NOT EXISTS chapters JSONB DEFAULT '[]'; -- Add comments for documentation COMMENT ON COLUMN products.chapters IS 'Video chapters/timeline markers stored as JSON array of {time: number, title: string}'; COMMENT ON COLUMN bootcamp_lessons.chapters IS 'Video chapters/timeline markers stored as JSON array of {time: number, title: string}'; -- Create index for faster queries on products with chapters CREATE INDEX IF NOT EXISTS idx_products_has_chapters ON products ((jsonb_array_length(chapters) > 0)); -- Create index for faster queries on lessons with chapters CREATE INDEX IF NOT EXISTS idx_bootcamp_lessons_has_chapters ON bootcamp_lessons ((jsonb_array_length(chapters) > 0));