-- Fixtures for migration safety rules (MIG001-MIG003).
-- Every statement here should trigger at least one finding.

-- MIG001: non-concurrent index
CREATE INDEX idx_orders_user ON orders(user_id);

-- MIG002: ADD COLUMN NOT NULL without DEFAULT
ALTER TABLE orders ADD COLUMN status text NOT NULL;

-- MIG003: ADD FOREIGN KEY without NOT VALID
ALTER TABLE orders
  ADD CONSTRAINT fk_orders_user FOREIGN KEY (user_id) REFERENCES users(id);

-- MIG003: ADD CHECK without NOT VALID
ALTER TABLE orders ADD CONSTRAINT chk_positive CHECK (amount > 0);
