text: const UpdateBanks = {
  
    databaseName: 'maha',
  
    up: async (knex) => {
  
      await knex.schema.alterTable('finance_banks', function(table) {
        table.decimal('transaction_fee', 3, 2)
        table.decimal('paypal_rate', 5, 4)
        table.decimal('paypal_transaction_fee', 3, 2)
      })
  
      await knex('finance_banks').update({
        transaction_fee: 0.30
      })
  
      await knex('finance_banks').where('has_paypal', true).update({
        paypal_rate: 0.0350,
        paypal_transaction_fee: 0.49
      })
  
      await knex('finance_payments').where('date', '>=', '2021-08-02').where('method', 'paypal').update({
        rate: 0.0350,
        transaction_fee: 0.49,
        cross_border_rate: 0.0000
      })
  
      await knex.raw(`
        create or replace view finance_payment_details as
        with fees as (
        select finance_payments.id as payment_id,
        case
        when finance_payments.method = 'paypal' and date < '2021-08-02' then round(round(((finance_payments.rate + finance_payments.cross_border_rate) * finance_payments.amount + finance_payments.transaction_fee) * 100, 0) / 100, 2)
        when finance_payments.rate is not null then round(floor(((finance_payments.rate + finance_payments.cross_border_rate) * finance_payments.amount + finance_payments.transaction_fee) * 100) / 100, 2)
        else 0.00
        end as fee
        from finance_payments
        )
        select finance_payments.id as payment_id,
        deposit_id,
        case
        when finance_payments.method in ('scholarship','credit','cash') then null
        when finance_payments.method='check' then concat('#',finance_payments.reference)
        when finance_payments.method='paypal' then finance_payment_methods.email
        else upper(concat(finance_payment_methods.card_type,'-',finance_payment_methods.last_four))
        end as description,
        fees.fee,
        amount - fees.fee as disbursed
        from finance_payments
        left join finance_payment_methods on finance_payment_methods.id = finance_payments.payment_method_id
        left join fees on fees.payment_id = finance_payments.id
      `)
  
    },
  
    down: async (knex) => {
    }
  
  }
  
  export default UpdateBanks
  