-- Migration: Create printer models and product compatibility junction table

CREATE TABLE printer_models (
  id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
  name VARCHAR(100) NOT NULL UNIQUE,
  series VARCHAR(50) NOT NULL
);

CREATE TABLE product_printer_compatibility (
  product_id UUID REFERENCES products(id) ON DELETE CASCADE,
  printer_model_id UUID REFERENCES printer_models(id) ON DELETE CASCADE,
  PRIMARY KEY (product_id, printer_model_id)
);

-- Seed printer models
INSERT INTO printer_models (name, series) VALUES
  ('A1 Mini', 'A'),
  ('A1', 'A'),
  ('P1P', 'P'),
  ('P1S', 'P'),
  ('X1C', 'X'),
  ('X1E', 'X'),
  ('H2D', 'H'),
  ('H2S', 'H'),
  ('P2S', 'P');
