-- Migration: Expanded product fields (compare price, barcode, vendor, tags, SEO, dimensions, variants)
-- Run this against an existing database

USE BeezifiIOM;

ALTER TABLE products
    ADD COLUMN IF NOT EXISTS compare_at_price   DECIMAL(12,2)  NULL         AFTER base_price,
    ADD COLUMN IF NOT EXISTS barcode             VARCHAR(100)   NULL         AFTER sku,
    ADD COLUMN IF NOT EXISTS vendor              VARCHAR(255)   NULL         AFTER barcode,
    ADD COLUMN IF NOT EXISTS tags                TEXT           NULL         AFTER vendor,
    ADD COLUMN IF NOT EXISTS seo_title           VARCHAR(255)   NULL         AFTER tags,
    ADD COLUMN IF NOT EXISTS seo_description     TEXT           NULL         AFTER seo_title,
    ADD COLUMN IF NOT EXISTS dimensions_length   DECIMAL(8,2)   NULL         AFTER weight,
    ADD COLUMN IF NOT EXISTS dimensions_width    DECIMAL(8,2)   NULL         AFTER dimensions_length,
    ADD COLUMN IF NOT EXISTS dimensions_height   DECIMAL(8,2)   NULL         AFTER dimensions_width,
    ADD COLUMN IF NOT EXISTS requires_shipping   BOOLEAN        NOT NULL DEFAULT TRUE  AFTER dimensions_height,
    ADD COLUMN IF NOT EXISTS taxable             BOOLEAN        NOT NULL DEFAULT TRUE  AFTER requires_shipping,
    ADD COLUMN IF NOT EXISTS track_inventory     BOOLEAN        NOT NULL DEFAULT TRUE  AFTER taxable,
    ADD COLUMN IF NOT EXISTS variant_options     JSON           NULL         AFTER has_variants;
