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

export const up: Migration = async ({ context }) => {
  await safeApplyColumnChanges(context, {
    meter_events: [
      {
        name: 'source_data',
        field: {
          type: DataTypes.JSON,
          allowNull: true,
        },
      },
    ],
  });
};

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