diff --git a/packages/pipeline/migrations/1550163069315-TokenOrderBookSnapshotsAddMakerAddress.ts b/packages/pipeline/migrations/1550163069315-TokenOrderBookSnapshotsAddMakerAddress.ts index 1d3b3c3ab5..7eba2fab6f 100644 --- a/packages/pipeline/migrations/1550163069315-TokenOrderBookSnapshotsAddMakerAddress.ts +++ b/packages/pipeline/migrations/1550163069315-TokenOrderBookSnapshotsAddMakerAddress.ts @@ -21,8 +21,8 @@ export class TokenOrderBookSnapshotsAddMakerAddress1550163069315 implements Migr `); await queryRunner.query(` ALTER TABLE ${TOKEN_ORDERBOOK_SNAPSHOT_TABLE} - DROP CONSTRAINT "token_orderbook_snapshots_pkey1", - ADD PRIMARY KEY (observed_timestamp, source, order_type, price, base_asset_symbol, quote_asset_symbol, maker_address); + DROP CONSTRAINT "token_orderbook_snapshots_pkey", + ADD CONSTRAINT "token_orderbook_snapshots_pkey" PRIMARY KEY (observed_timestamp, source, order_type, price, base_asset_symbol, quote_asset_symbol, maker_address); `); } else { throw new Error(`Could not find table with name ${TOKEN_ORDERBOOK_SNAPSHOT_TABLE}`); @@ -32,7 +32,12 @@ export class TokenOrderBookSnapshotsAddMakerAddress1550163069315 implements Migr public async down(queryRunner: QueryRunner): Promise { const snapshotTable = await queryRunner.getTable(TOKEN_ORDERBOOK_SNAPSHOT_TABLE); if (snapshotTable) { - await queryRunner.dropColumn(snapshotTable, NEW_COLUMN_NAME); + await queryRunner.query(` + ALTER TABLE ${TOKEN_ORDERBOOK_SNAPSHOT_TABLE} + DROP CONSTRAINT "token_orderbook_snapshots_pkey", + DROP COLUMN ${NEW_COLUMN_NAME}, + ADD CONSTRAINT "token_orderbook_snapshots_pkey" PRIMARY KEY (observed_timestamp, source, order_type, price, base_asset_symbol, quote_asset_symbol); + `); } else { throw new Error(`Could not find table with name ${TOKEN_ORDERBOOK_SNAPSHOT_TABLE}`); }