-- Migration 009: Extended Item Fields
--
-- Adds sourcing classification, sourcing link, long description, and standard cost
-- directly to the items table for first-class item metadata.

-- Sourcing type: manufactured in-house vs. purchased/COTS
-- Using a check constraint rather than an enum for flexibility.
ALTER TABLE items ADD COLUMN sourcing_type VARCHAR(20) NOT NULL DEFAULT 'manufactured'
    CHECK (sourcing_type IN ('manufactured', 'purchased'));

-- Sourcing link: URL to supplier page, datasheet, or procurement source
ALTER TABLE items ADD COLUMN sourcing_link TEXT;

-- Long description: extended description for detailed specifications, notes, etc.
ALTER TABLE items ADD COLUMN long_description TEXT;

-- Standard cost: baseline unit cost for budgeting/estimation (precision: up to $9,999,999.99)
ALTER TABLE items ADD COLUMN standard_cost DECIMAL(12, 4);

-- Index on sourcing_type for filtering
CREATE INDEX idx_items_sourcing_type ON items(sourcing_type);
