/* eslint-disable no-await-in-loop */
import { DataTypes } from 'sequelize';

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

export const up: Migration = async ({ context }) => {
  await safeApplyColumnChanges(context, {
    usage_records: [
      {
        name: 'billed',
        field: {
          type: DataTypes.BOOLEAN,
          defaultValue: false,
        },
      },
    ],
  });
};

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