import { DataTypes } from 'sequelize';

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

export const up: Migration = async ({ context }) => {
  await safeApplyColumnChanges(context, {
    subscriptions: [
      {
        name: 'recovered_from',
        field: {
          type: DataTypes.STRING(40),
          allowNull: true,
        },
      },
    ],
  });
};

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