aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/pipeline/migrations/1542070840010-InitialSchema.ts241
-rw-r--r--packages/pipeline/package.json2
-rw-r--r--packages/pipeline/src/entities/block.ts2
-rw-r--r--packages/pipeline/src/entities/exchange_cancel_event.ts2
-rw-r--r--packages/pipeline/src/entities/exchange_cancel_up_to_event.ts2
-rw-r--r--packages/pipeline/src/entities/exchange_fill_event.ts2
-rw-r--r--packages/pipeline/src/entities/relayer.ts2
-rw-r--r--packages/pipeline/src/entities/sra_order.ts2
-rw-r--r--packages/pipeline/src/entities/token_on_chain_metadata.ts4
-rw-r--r--packages/pipeline/src/entities/transaction.ts2
10 files changed, 129 insertions, 132 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);
diff --git a/packages/pipeline/package.json b/packages/pipeline/package.json
index 59cf24dc6..dcd19d150 100644
--- a/packages/pipeline/package.json
+++ b/packages/pipeline/package.json
@@ -13,7 +13,7 @@
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"clean": "shx rm -rf lib",
- "lint": "tslint --project . --format stylish --exclude ./migrations",
+ "lint": "tslint --project . --format stylish --exclude ./migrations/**/*",
"migrate:run": "yarn typeorm migration:run --config ./lib/src/ormconfig",
"migrate:revert": "yarn typeorm migration:revert --config ./lib/src/ormconfig",
"migrate:create": "yarn typeorm migration:create --config ./lib/src/ormconfig --dir migrations"
diff --git a/packages/pipeline/src/entities/block.ts b/packages/pipeline/src/entities/block.ts
index 5bd51f3d2..51be37703 100644
--- a/packages/pipeline/src/entities/block.ts
+++ b/packages/pipeline/src/entities/block.ts
@@ -1,6 +1,6 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity({ name: 'blocks' })
+@Entity({ name: 'blocks', schema: 'raw' })
export class Block {
@PrimaryColumn() public hash!: string;
@PrimaryColumn() public number!: number;
diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts
index 6d0c3bc32..781e1c4bb 100644
--- a/packages/pipeline/src/entities/exchange_cancel_event.ts
+++ b/packages/pipeline/src/entities/exchange_cancel_event.ts
@@ -2,7 +2,7 @@ import { Column, Entity, PrimaryColumn } from 'typeorm';
import { AssetType } from '../types';
-@Entity({ name: 'exchange_cancel_events' })
+@Entity({ name: 'exchange_cancel_events', schema: 'raw' })
export class ExchangeCancelEvent {
@PrimaryColumn({ name: 'contract_address' })
public contractAddress!: string;
diff --git a/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
index bc3bab6bb..7306a1a87 100644
--- a/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
+++ b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
@@ -1,6 +1,6 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity({ name: 'exchange_cancel_up_to_events' })
+@Entity({ name: 'exchange_cancel_up_to_events', schema: 'raw' })
export class ExchangeCancelUpToEvent {
@PrimaryColumn({ name: 'contract_address' })
public contractAddress!: string;
diff --git a/packages/pipeline/src/entities/exchange_fill_event.ts b/packages/pipeline/src/entities/exchange_fill_event.ts
index 0c5546d7e..6202e558b 100644
--- a/packages/pipeline/src/entities/exchange_fill_event.ts
+++ b/packages/pipeline/src/entities/exchange_fill_event.ts
@@ -2,7 +2,7 @@ import { Column, Entity, PrimaryColumn } from 'typeorm';
import { AssetType } from '../types';
-@Entity({ name: 'exchange_fill_events' })
+@Entity({ name: 'exchange_fill_events', schema: 'raw' })
export class ExchangeFillEvent {
@PrimaryColumn({ name: 'contract_address' })
public contractAddress!: string;
diff --git a/packages/pipeline/src/entities/relayer.ts b/packages/pipeline/src/entities/relayer.ts
index 94b5232a8..ef1f9cf2a 100644
--- a/packages/pipeline/src/entities/relayer.ts
+++ b/packages/pipeline/src/entities/relayer.ts
@@ -1,6 +1,6 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity({ name: 'relayers' })
+@Entity({ name: 'relayers', schema: 'raw' })
export class Relayer {
@PrimaryColumn() public uuid!: string;
diff --git a/packages/pipeline/src/entities/sra_order.ts b/packages/pipeline/src/entities/sra_order.ts
index f3f79852f..e59161c81 100644
--- a/packages/pipeline/src/entities/sra_order.ts
+++ b/packages/pipeline/src/entities/sra_order.ts
@@ -2,7 +2,7 @@ import { Column, Entity, PrimaryColumn } from 'typeorm';
import { AssetType } from '../types';
-@Entity({ name: 'sra_orders' })
+@Entity({ name: 'sra_orders', schema: 'raw' })
export class SraOrder {
@PrimaryColumn({ name: 'exchange_address' })
public exchangeAddress!: string;
diff --git a/packages/pipeline/src/entities/token_on_chain_metadata.ts b/packages/pipeline/src/entities/token_on_chain_metadata.ts
index fc21d0aed..325d28e91 100644
--- a/packages/pipeline/src/entities/token_on_chain_metadata.ts
+++ b/packages/pipeline/src/entities/token_on_chain_metadata.ts
@@ -1,6 +1,6 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity({ name: 'token_on_chain_metadata' })
+@Entity({ name: 'token_on_chain_metadata', schema: 'raw' })
export class TokenOnChainMetadata {
@PrimaryColumn({ type: 'nvarchar', nullable: false })
public address!: string;
@@ -13,4 +13,4 @@ export class TokenOnChainMetadata {
@Column({ type: 'nvarchar', nullable: false })
public name!: string;
-} \ No newline at end of file
+}
diff --git a/packages/pipeline/src/entities/transaction.ts b/packages/pipeline/src/entities/transaction.ts
index eb2883fda..dd2143df5 100644
--- a/packages/pipeline/src/entities/transaction.ts
+++ b/packages/pipeline/src/entities/transaction.ts
@@ -1,6 +1,6 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity({ name: 'transactions' })
+@Entity({ name: 'transactions', schema: 'raw' })
export class Transaction {
@PrimaryColumn({ name: 'transaction_hash' })
public transactionHash!: string;