-- Migration 028: Extend stock_observations with full warehouse breakdown
-- Adds FS.com warehouse columns: DE-Lager, Global-Lager, Nachlieferung,
-- units_sold, compatible_brands, price_net, product_url.
-- NOTE: This migration was applied directly on Erik before being committed to the repo.
--       All ADD COLUMN statements use IF NOT EXISTS guards for safe re-application.

ALTER TABLE stock_observations
  ADD COLUMN IF NOT EXISTS warehouse_de_qty             INTEGER,
  ADD COLUMN IF NOT EXISTS warehouse_de_delivery_date   DATE,
  ADD COLUMN IF NOT EXISTS warehouse_global_qty         INTEGER,
  ADD COLUMN IF NOT EXISTS warehouse_global_delivery_date DATE,
  ADD COLUMN IF NOT EXISTS backorder_qty                INTEGER,
  ADD COLUMN IF NOT EXISTS backorder_estimated_date     DATE,
  ADD COLUMN IF NOT EXISTS units_sold                   BIGINT,
  ADD COLUMN IF NOT EXISTS compatible_brands            TEXT[],
  ADD COLUMN IF NOT EXISTS price_net                    NUMERIC(12,4),
  ADD COLUMN IF NOT EXISTS product_url                  TEXT;
