Merge branch 'development' into supportEIP1193Providers

* development:
  Add constraint name to down phase as well
  Give the constraint an explicit name of token_orderbook_snapshots_pkey
  Remove comments
  Fix inconsistently named constraint
This commit is contained in:
Fabio Berger
2019-02-20 18:01:23 -08:00

View File

@@ -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<any> {
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}`);
}