-- Fixtures for migration safety rules — all statements are safe.

-- MIG001 safe: CONCURRENTLY
CREATE INDEX CONCURRENTLY idx_orders_user ON orders(user_id);

-- MIG002 safe: nullable column (no NOT NULL)
ALTER TABLE orders ADD COLUMN note text;

-- MIG002 safe: NOT NULL with a DEFAULT
ALTER TABLE orders ADD COLUMN status text NOT NULL DEFAULT 'pending';

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

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