message: indexer-agent: Make fee columns migration more robust
diff: @@ -16,24 +16,34 @@ export async function up({ context }: Context): Promise<void> {
  logger.info(`Rename fee columns`)
  return await queryInterface.sequelize.transaction({}, async transaction => {
  + const tables = await queryInterface.showAllTables()
  +
  + if (tables.includes('allocation_receipts')) {
  await queryInterface.renameColumn(
  'allocation_receipts',
  'paymentAmount',
  'fees',
  { transaction },
  )
  + }
  +
  + if (tables.includes('allocation_summaries')) {
  await queryInterface.renameColumn(
  'allocation_summaries',
  'queryFees',
  'collectedFees',
  { transaction },
  )
  + }
  +
  + if (tables.includes('transfer_receipts')) {
  await queryInterface.renameColumn(
  'transfer_receipts',
  'paymentAmount',
  'fees',
  { transaction },
  )
  + }
  })
  }
  @@ -43,23 +53,31 @@ export async function down({ context }: Context): Promise<void> {
  logger.info(`Revert renaming fee columns`)
  return await queryInterface.sequelize.transaction({}, async transaction => {
  + const tables = await queryInterface.showAllTables()
  +
  + if (tables.includes('allocation_receipts')) {
  await queryInterface.renameColumn(
  'allocation_receipts',
  'fees',
  'paymentAmount',
  { transaction },
  )
  + }
  + if (tables.includes('allocation_summaries')) {
  await queryInterface.renameColumn(
  'allocation_summaries',
  'collectedFees',
  'queryFees',
  { transaction },
  )
  + }
  + if (tables.includes('transfer_receipts')) {
  await queryInterface.renameColumn(
  'transfer_receipts',
  'fees',
  'paymentAmount',
  { transaction },
  )
  + }
  })
  }
  