diff --git a/indexer/packages/postgres/src/db/migrations/migration_files/20240910101410_change_fills_affiliaterevshare_type.ts b/indexer/packages/postgres/src/db/migrations/migration_files/20240910101410_change_fills_affiliaterevshare_type.ts index dd61af5d3b..96d7b48083 100644 --- a/indexer/packages/postgres/src/db/migrations/migration_files/20240910101410_change_fills_affiliaterevshare_type.ts +++ b/indexer/packages/postgres/src/db/migrations/migration_files/20240910101410_change_fills_affiliaterevshare_type.ts @@ -2,15 +2,21 @@ import * as Knex from 'knex'; // No data has been stored added at time of commit export async function up(knex: Knex): Promise { - return knex.schema.alterTable('fills', (table) => { - // decimal('columnName') has is 8,2 precision and scale - // decimal('columnName', null) has variable precision and scale - table.decimal('affiliateRevShare', null).notNullable().defaultTo(0).alter(); + // decimal('columnName') has is 8,2 precision and scale + // decimal('columnName', null) has variable precision and scale + await knex.schema.alterTable('fills', (table) => { + table.dropColumn('affiliateRevShare'); + }); + await knex.schema.alterTable('fills', (table) => { + table.decimal('affiliateRevShare', null).notNullable().defaultTo(0); }); } export async function down(knex: Knex): Promise { - return knex.schema.alterTable('fills', (table) => { - table.string('affiliateRevShare').notNullable().defaultTo('0').alter(); + await knex.schema.alterTable('fills', (table) => { + table.dropColumn('affiliateRevShare'); + }); + await knex.schema.alterTable('fills', (table) => { + table.string('affiliateRevShare').notNullable().defaultTo('0'); }); }