-- Feed Pipeline v3 Migration
ALTER TABLE products ADD COLUMN IF NOT EXISTS category TEXT;
ALTER TABLE products ADD COLUMN IF NOT EXISTS product_type TEXT;

CREATE TABLE IF NOT EXISTS import_rejects (
  id SERIAL PRIMARY KEY,
  feed_id INTEGER REFERENCES feeds(id),
  external_id VARCHAR(255),
  name TEXT,
  brand TEXT,
  category TEXT,
  reason TEXT,
  created_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_rejects_feed ON import_rejects(feed_id);
CREATE INDEX IF NOT EXISTS idx_rejects_created ON import_rejects(created_at);
