/**
 * F-138: orders_order_history.metadata holds the structured payload for
 * machine-readable events (returns, refunds, etc.) so we can keep the
 * human-visible `message` column short and friendly while preserving all the
 * detail that internal tooling needs.
 * @param {import('node-pg-migrate').MigrationBuilder} pgm
 */
export const up = (pgm) => {
  pgm.sql(`
    ALTER TABLE orders_order_history
      ADD COLUMN IF NOT EXISTS metadata jsonb NULL
  `);
};

export const down = (pgm) => {
  pgm.sql(`
    ALTER TABLE orders_order_history
      DROP COLUMN IF EXISTS metadata
  `);
};
