import { createIndexIfNotExists, type Migration } from '../migrate';
import models from '../models';

export const up: Migration = async ({ context }) => {
  await context.createTable('tax_rates', models.TaxRate.GENESIS_ATTRIBUTES);

  await createIndexIfNotExists(
    context,
    'tax_rates',
    ['country', 'state', 'postal_code', 'tax_code'],
    'tax_rates_query_index'
  );
};

export const down: Migration = async ({ context }) => {
  await context.dropTable('tax_rates');
};
