-- Apply to the configured products database to update an existing installation.
ALTER TABLE `stationary_products`
  ADD COLUMN IF NOT EXISTS `original_price` DECIMAL(10,2) NULL AFTER `price`,
  ADD COLUMN IF NOT EXISTS `discount_price` DECIMAL(10,2) NULL AFTER `original_price`,
  ADD COLUMN IF NOT EXISTS `image_views` JSON NULL AFTER `image`,
  ADD COLUMN IF NOT EXISTS `color_variants` JSON NULL AFTER `image_views`,
  ADD COLUMN IF NOT EXISTS `specifications` JSON NULL AFTER `color_variants`,
  ADD COLUMN IF NOT EXISTS `offers` JSON NULL AFTER `specifications`,
  ADD COLUMN IF NOT EXISTS `brand` VARCHAR(180) NULL AFTER `offers`,
  ADD COLUMN IF NOT EXISTS `average_rating` DECIMAL(2,1) NULL AFTER `brand`,
  ADD COLUMN IF NOT EXISTS `review_count` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `average_rating`,
  ADD COLUMN IF NOT EXISTS `delivery_estimate` VARCHAR(180) NULL AFTER `review_count`,
  ADD COLUMN IF NOT EXISTS `return_policy` VARCHAR(180) NULL AFTER `delivery_estimate`,
  ADD COLUMN IF NOT EXISTS `tax_inclusive` TINYINT(1) NULL AFTER `return_policy`;

ALTER TABLE `handmade_products`
  ADD COLUMN IF NOT EXISTS `original_price` DECIMAL(10,2) NULL AFTER `price`,
  ADD COLUMN IF NOT EXISTS `discount_price` DECIMAL(10,2) NULL AFTER `original_price`,
  ADD COLUMN IF NOT EXISTS `image_views` JSON NULL AFTER `image`,
  ADD COLUMN IF NOT EXISTS `color_variants` JSON NULL AFTER `image_views`,
  ADD COLUMN IF NOT EXISTS `specifications` JSON NULL AFTER `color_variants`,
  ADD COLUMN IF NOT EXISTS `offers` JSON NULL AFTER `specifications`,
  ADD COLUMN IF NOT EXISTS `brand` VARCHAR(180) NULL AFTER `offers`,
  ADD COLUMN IF NOT EXISTS `average_rating` DECIMAL(2,1) NULL AFTER `brand`,
  ADD COLUMN IF NOT EXISTS `review_count` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `average_rating`,
  ADD COLUMN IF NOT EXISTS `delivery_estimate` VARCHAR(180) NULL AFTER `review_count`,
  ADD COLUMN IF NOT EXISTS `return_policy` VARCHAR(180) NULL AFTER `delivery_estimate`,
  ADD COLUMN IF NOT EXISTS `tax_inclusive` TINYINT(1) NULL AFTER `return_policy`;

ALTER TABLE `cleaning_products`
  ADD COLUMN IF NOT EXISTS `original_price` DECIMAL(10,2) NULL AFTER `price`,
  ADD COLUMN IF NOT EXISTS `discount_price` DECIMAL(10,2) NULL AFTER `original_price`,
  ADD COLUMN IF NOT EXISTS `image_views` JSON NULL AFTER `image`,
  ADD COLUMN IF NOT EXISTS `color_variants` JSON NULL AFTER `image_views`,
  ADD COLUMN IF NOT EXISTS `specifications` JSON NULL AFTER `color_variants`,
  ADD COLUMN IF NOT EXISTS `offers` JSON NULL AFTER `specifications`,
  ADD COLUMN IF NOT EXISTS `brand` VARCHAR(180) NULL AFTER `offers`,
  ADD COLUMN IF NOT EXISTS `average_rating` DECIMAL(2,1) NULL AFTER `brand`,
  ADD COLUMN IF NOT EXISTS `review_count` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `average_rating`,
  ADD COLUMN IF NOT EXISTS `delivery_estimate` VARCHAR(180) NULL AFTER `review_count`,
  ADD COLUMN IF NOT EXISTS `return_policy` VARCHAR(180) NULL AFTER `delivery_estimate`,
  ADD COLUMN IF NOT EXISTS `tax_inclusive` TINYINT(1) NULL AFTER `return_policy`;

ALTER TABLE `seasonal_products`
  ADD COLUMN IF NOT EXISTS `original_price` DECIMAL(10,2) NULL AFTER `price`,
  ADD COLUMN IF NOT EXISTS `discount_price` DECIMAL(10,2) NULL AFTER `original_price`,
  ADD COLUMN IF NOT EXISTS `image_views` JSON NULL AFTER `image`,
  ADD COLUMN IF NOT EXISTS `color_variants` JSON NULL AFTER `image_views`,
  ADD COLUMN IF NOT EXISTS `specifications` JSON NULL AFTER `color_variants`,
  ADD COLUMN IF NOT EXISTS `offers` JSON NULL AFTER `specifications`,
  ADD COLUMN IF NOT EXISTS `brand` VARCHAR(180) NULL AFTER `offers`,
  ADD COLUMN IF NOT EXISTS `average_rating` DECIMAL(2,1) NULL AFTER `brand`,
  ADD COLUMN IF NOT EXISTS `review_count` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `average_rating`,
  ADD COLUMN IF NOT EXISTS `delivery_estimate` VARCHAR(180) NULL AFTER `review_count`,
  ADD COLUMN IF NOT EXISTS `return_policy` VARCHAR(180) NULL AFTER `delivery_estimate`,
  ADD COLUMN IF NOT EXISTS `tax_inclusive` TINYINT(1) NULL AFTER `return_policy`;
