aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/migrations/1542070840010-InitialSchema.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/pipeline/migrations/1542070840010-InitialSchema.ts')
-rw-r--r--packages/pipeline/migrations/1542070840010-InitialSchema.ts241
1 files changed, 119 insertions, 122 deletions
diff --git a/packages/pipeline/migrations/1542070840010-InitialSchema.ts b/packages/pipeline/migrations/1542070840010-InitialSchema.ts
index cf240a1ed..895f9e6c9 100644
--- a/packages/pipeline/migrations/1542070840010-InitialSchema.ts
+++ b/packages/pipeline/migrations/1542070840010-InitialSchema.ts
@@ -1,167 +1,165 @@
-import {MigrationInterface, QueryRunner, Table} from "typeorm";
+import { MigrationInterface, QueryRunner, Table } from 'typeorm';
const blocks = new Table({
name: 'raw.blocks',
columns: [
- {name: 'number', type: 'bigint', isPrimary: true},
- {name: 'hash', type: 'varchar', isPrimary: true},
- {name: 'timestamp', type: 'bigint'}
- ]
+ { name: 'number', type: 'bigint', isPrimary: true },
+ { name: 'hash', type: 'varchar', isPrimary: true },
+ { name: 'timestamp', type: 'bigint' },
+ ],
});
const exchange_cancel_events = new Table({
name: 'raw.exchange_cancel_events',
columns: [
- {name: 'contract_address', type: 'char(42)', isPrimary: true},
- {name: 'log_index', type: 'integer', isPrimary: true},
- {name: 'block_number', type: 'bigint', isPrimary: true},
-
- {name: 'raw_data', type: 'varchar'},
-
- {name: 'transaction_hash', type: 'varchar'},
- {name: 'maker_address', type: 'char(42)'},
- {name: 'taker_address', type: 'char(42)'},
- {name: 'fee_recipient_address', type: 'char(42)'},
- {name: 'sender_address', type: 'char(42)'},
- {name: 'order_hash', type: 'varchar'},
-
- {name: 'raw_maker_asset_data', type: 'varchar'},
- {name: 'maker_asset_type', type: 'varchar'},
- {name: 'maker_asset_proxy_id', type: 'varchar'},
- {name: 'maker_token_address', type: 'char(42)'},
- {name: 'maker_token_id', type: 'varchar', isNullable: true},
- {name: 'raw_taker_asset_data', type: 'varchar'},
- {name: 'taker_asset_type', type: 'varchar'},
- {name: 'taker_asset_proxy_id', type: 'varchar'},
- {name: 'taker_token_address', type: 'char(42)'},
- {name: 'taker_token_id', type: 'varchar', isNullable: true}
- ]
+ { name: 'contract_address', type: 'char(42)', isPrimary: true },
+ { name: 'log_index', type: 'integer', isPrimary: true },
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+
+ { name: 'raw_data', type: 'varchar' },
+
+ { name: 'transaction_hash', type: 'varchar' },
+ { name: 'maker_address', type: 'char(42)' },
+ { name: 'taker_address', type: 'char(42)' },
+ { name: 'fee_recipient_address', type: 'char(42)' },
+ { name: 'sender_address', type: 'char(42)' },
+ { name: 'order_hash', type: 'varchar' },
+
+ { name: 'raw_maker_asset_data', type: 'varchar' },
+ { name: 'maker_asset_type', type: 'varchar' },
+ { name: 'maker_asset_proxy_id', type: 'varchar' },
+ { name: 'maker_token_address', type: 'char(42)' },
+ { name: 'maker_token_id', type: 'varchar', isNullable: true },
+ { name: 'raw_taker_asset_data', type: 'varchar' },
+ { name: 'taker_asset_type', type: 'varchar' },
+ { name: 'taker_asset_proxy_id', type: 'varchar' },
+ { name: 'taker_token_address', type: 'char(42)' },
+ { name: 'taker_token_id', type: 'varchar', isNullable: true },
+ ],
});
const exchange_cancel_up_to_events = new Table({
name: 'raw.exchange_cancel_up_to_events',
columns: [
- {name: 'contract_address', type: 'char(42)', isPrimary: true},
- {name: 'log_index', type: 'integer', isPrimary: true},
- {name: 'block_number', type: 'bigint', isPrimary: true},
-
- {name: 'raw_data', type: 'varchar'},
-
- {name: 'transaction_hash', type: 'varchar'},
- {name: 'maker_address', type: 'char(42)'},
- {name: 'sender_address', type: 'char(42)'},
- {name: 'order_epoch', type: 'varchar'}
- ]
+ { name: 'contract_address', type: 'char(42)', isPrimary: true },
+ { name: 'log_index', type: 'integer', isPrimary: true },
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+
+ { name: 'raw_data', type: 'varchar' },
+
+ { name: 'transaction_hash', type: 'varchar' },
+ { name: 'maker_address', type: 'char(42)' },
+ { name: 'sender_address', type: 'char(42)' },
+ { name: 'order_epoch', type: 'varchar' },
+ ],
});
const exchange_fill_events = new Table({
name: 'raw.exchange_fill_events',
columns: [
- {name: 'contract_address', type: 'char(42)', isPrimary: true},
- {name: 'log_index', type: 'integer', isPrimary: true},
- {name: 'block_number', type: 'bigint', isPrimary: true},
-
- {name: 'raw_data', type: 'varchar'},
-
- {name: 'transaction_hash', type: 'varchar'},
- {name: 'maker_address', type: 'char(42)'},
- {name: 'taker_address', type: 'char(42)'},
- {name: 'fee_recipient_address', type: 'char(42)'},
- {name: 'sender_address', type: 'char(42)'},
- {name: 'maker_asset_filled_amount', type: 'varchar'},
- {name: 'taker_asset_filled_amount', type: 'varchar'},
- {name: 'maker_fee_paid', type: 'varchar'},
- {name: 'taker_fee_paid', type: 'varchar'},
- {name: 'order_hash', type: 'varchar'},
-
- {name: 'raw_maker_asset_data', type: 'varchar'},
- {name: 'maker_asset_type', type: 'varchar'},
- {name: 'maker_asset_proxy_id', type: 'varchar'},
- {name: 'maker_token_address', type: 'char(42)'},
- {name: 'maker_token_id', type: 'varchar', isNullable: true},
- {name: 'raw_taker_asset_data', type: 'varchar'},
- {name: 'taker_asset_type', type: 'varchar'},
- {name: 'taker_asset_proxy_id', type: 'varchar'},
- {name: 'taker_token_address', type: 'char(42)'},
- {name: 'taker_token_id', type: 'varchar', isNullable: true}
- ]
+ { name: 'contract_address', type: 'char(42)', isPrimary: true },
+ { name: 'log_index', type: 'integer', isPrimary: true },
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+
+ { name: 'raw_data', type: 'varchar' },
+
+ { name: 'transaction_hash', type: 'varchar' },
+ { name: 'maker_address', type: 'char(42)' },
+ { name: 'taker_address', type: 'char(42)' },
+ { name: 'fee_recipient_address', type: 'char(42)' },
+ { name: 'sender_address', type: 'char(42)' },
+ { name: 'maker_asset_filled_amount', type: 'varchar' },
+ { name: 'taker_asset_filled_amount', type: 'varchar' },
+ { name: 'maker_fee_paid', type: 'varchar' },
+ { name: 'taker_fee_paid', type: 'varchar' },
+ { name: 'order_hash', type: 'varchar' },
+
+ { name: 'raw_maker_asset_data', type: 'varchar' },
+ { name: 'maker_asset_type', type: 'varchar' },
+ { name: 'maker_asset_proxy_id', type: 'varchar' },
+ { name: 'maker_token_address', type: 'char(42)' },
+ { name: 'maker_token_id', type: 'varchar', isNullable: true },
+ { name: 'raw_taker_asset_data', type: 'varchar' },
+ { name: 'taker_asset_type', type: 'varchar' },
+ { name: 'taker_asset_proxy_id', type: 'varchar' },
+ { name: 'taker_token_address', type: 'char(42)' },
+ { name: 'taker_token_id', type: 'varchar', isNullable: true },
+ ],
});
const relayers = new Table({
name: 'raw.relayers',
columns: [
- {name: 'uuid', type: 'varchar', isPrimary: true},
- {name: 'name', type: 'varchar'},
- {name: 'sra_http_endpoint', type: 'varchar', isNullable: true},
- {name: 'sra_ws_endpoint', type: 'varchar', isNullable: true},
- {name: 'app_url', type: 'varchar', isNullable: true},
- {name: 'fee_recipient_addresses', type: 'char(42)', isArray: true},
- {name: 'taker_addresses', type: 'char(42)', isArray: true}
- ]
+ { name: 'uuid', type: 'varchar', isPrimary: true },
+ { name: 'name', type: 'varchar' },
+ { name: 'sra_http_endpoint', type: 'varchar', isNullable: true },
+ { name: 'sra_ws_endpoint', type: 'varchar', isNullable: true },
+ { name: 'app_url', type: 'varchar', isNullable: true },
+ { name: 'fee_recipient_addresses', type: 'char(42)', isArray: true },
+ { name: 'taker_addresses', type: 'char(42)', isArray: true },
+ ],
});
const sra_orders = new Table({
name: 'raw.sra_orders',
columns: [
- {name: 'exchange_address', type: 'char(42)', isPrimary: true},
- {name: 'order_hash_hex', type: 'varchar', isPrimary: true},
-
- {name: 'source_url', type: 'varchar'},
- {name: 'last_updated_timestamp', type: 'bigint'},
- {name: 'first_seen_timestamp', type: 'bigint'},
-
- {name: 'maker_address', type: 'char(42)'},
- {name: 'taker_address', type: 'char(42)'},
- {name: 'fee_recipient_address', type: 'char(42)'},
- {name: 'sender_address', type: 'char(42)'},
- {name: 'maker_asset_filled_amount', type: 'varchar'},
- {name: 'taker_asset_filled_amount', type: 'varchar'},
- {name: 'maker_fee', type: 'varchar'},
- {name: 'taker_fee', type: 'varchar'},
- {name: 'expiration_time_seconds', type: 'int'},
- {name: 'salt', type: 'varchar'},
- {name: 'signature', type: 'varchar'},
-
- {name: 'raw_maker_asset_data', type: 'varchar'},
- {name: 'maker_asset_type', type: 'varchar'},
- {name: 'maker_asset_proxy_id', type: 'varchar'},
- {name: 'maker_token_address', type: 'char(42)'},
- {name: 'maker_token_id', type: 'varchar', isNullable: true},
- {name: 'raw_taker_asset_data', type: 'varchar'},
- {name: 'taker_asset_type', type: 'varchar'},
- {name: 'taker_asset_proxy_id', type: 'varchar'},
- {name: 'taker_token_address', type: 'char(42)'},
- {name: 'taker_token_id', type: 'varchar', isNullable: true},
-
- {name: 'metadata_json', type: 'varchar'}
- ]
+ { name: 'exchange_address', type: 'char(42)', isPrimary: true },
+ { name: 'order_hash_hex', type: 'varchar', isPrimary: true },
+
+ { name: 'source_url', type: 'varchar' },
+ { name: 'last_updated_timestamp', type: 'bigint' },
+ { name: 'first_seen_timestamp', type: 'bigint' },
+
+ { name: 'maker_address', type: 'char(42)' },
+ { name: 'taker_address', type: 'char(42)' },
+ { name: 'fee_recipient_address', type: 'char(42)' },
+ { name: 'sender_address', type: 'char(42)' },
+ { name: 'maker_asset_filled_amount', type: 'varchar' },
+ { name: 'taker_asset_filled_amount', type: 'varchar' },
+ { name: 'maker_fee', type: 'varchar' },
+ { name: 'taker_fee', type: 'varchar' },
+ { name: 'expiration_time_seconds', type: 'int' },
+ { name: 'salt', type: 'varchar' },
+ { name: 'signature', type: 'varchar' },
+
+ { name: 'raw_maker_asset_data', type: 'varchar' },
+ { name: 'maker_asset_type', type: 'varchar' },
+ { name: 'maker_asset_proxy_id', type: 'varchar' },
+ { name: 'maker_token_address', type: 'char(42)' },
+ { name: 'maker_token_id', type: 'varchar', isNullable: true },
+ { name: 'raw_taker_asset_data', type: 'varchar' },
+ { name: 'taker_asset_type', type: 'varchar' },
+ { name: 'taker_asset_proxy_id', type: 'varchar' },
+ { name: 'taker_token_address', type: 'char(42)' },
+ { name: 'taker_token_id', type: 'varchar', isNullable: true },
+
+ { name: 'metadata_json', type: 'varchar' },
+ ],
});
const token_on_chain_metadata = new Table({
name: 'raw.token_on_chain_metadata',
columns: [
- {name: 'address', type: 'char(42)', isPrimary: true},
- {name: 'decimals', type: 'integer'},
- {name: 'symbol', type: 'varchar'},
- {name: 'name', type: 'varchar'}
- ]
+ { name: 'address', type: 'char(42)', isPrimary: true },
+ { name: 'decimals', type: 'integer' },
+ { name: 'symbol', type: 'varchar' },
+ { name: 'name', type: 'varchar' },
+ ],
});
const transactions = new Table({
name: 'raw.transactions',
columns: [
- {name: 'block_number', type: 'bigint', isPrimary: true},
- {name: 'block_hash', type: 'varchar', isPrimary: true},
- {name: 'transaction_hash', type: 'varchar', isPrimary: true},
- {name: 'gas_used', type: 'bigint'},
- {name: 'gas_price', type: 'bigint'}
- ]
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+ { name: 'block_hash', type: 'varchar', isPrimary: true },
+ { name: 'transaction_hash', type: 'varchar', isPrimary: true },
+ { name: 'gas_used', type: 'bigint' },
+ { name: 'gas_price', type: 'bigint' },
+ ],
});
export class InitialSchema1542070840010 implements MigrationInterface {
-
public async up(queryRunner: QueryRunner): Promise<any> {
-
await queryRunner.createSchema('raw');
await queryRunner.createTable(blocks);
@@ -175,7 +173,6 @@ export class InitialSchema1542070840010 implements MigrationInterface {
}
public async down(queryRunner: QueryRunner): Promise<any> {
-
await queryRunner.dropTable(blocks.name);
await queryRunner.dropTable(exchange_cancel_events.name);
await queryRunner.dropTable(exchange_cancel_up_to_events.name);