import { DataTypes } from 'sequelize';

import { Migration, safeApplyColumnChanges } from '../migrate';

export const up: Migration = async ({ context }) => {
  await safeApplyColumnChanges(context, {
    checkout_sessions: [
      {
        name: 'slippage_percent',
        field: {
          type: DataTypes.DECIMAL(5, 2),
          allowNull: false,
          defaultValue: 0.5,
        },
      },
    ],
  });
};

export const down: Migration = async ({ context }) => {
  await context.removeColumn('checkout_sessions', 'slippage_percent');
};
