protocol/packages/pipeline/migrations/1543540108767-CreateNftTrades.ts
F. Eugene Aumson 1232a9a03d
Integrate one-time dump and API for nonfungible.com (#1603)
* Add script for pulling NFT trade data from nonfungible.com

* corrections for current state of API

* change data model to match data source

* change primary key

* pull data from initial dump first, then API

* pull all supported NFT's, not just cryptokitties

* disable problematic data sources

* rename function to satisfy linter

* Rename table to nonfungible_dot_com_trades

* rename parser module to nonfungible_dot_com from non_fungible_dot_com, for consistency

* correct mistaken reference to Bloxy

* rename NonfungibleDotComTrade to ...TradeResponse

* `NftTrade` -> `NonfungibleDotComTrade`

* rename files to match prior object renaming

* use fetchAsync instead of axios

* improve fetchAsync error message: include URL

* avoid non-null contraints in API trades too, not just for trades from the one-time dump

* disable mythereum publisher
2019-02-19 19:07:42 -08:00

32 lines
1.2 KiB
TypeScript

import { MigrationInterface, QueryRunner, Table } from 'typeorm';
const nftTrades = new Table({
name: 'raw.nonfungible_dot_com_trades',
columns: [
{ name: 'publisher', type: 'varchar', isPrimary: true },
{ name: 'transaction_hash', type: 'varchar', isPrimary: true },
{ name: 'asset_id', type: 'varchar', isPrimary: true },
{ name: 'block_number', type: 'bigint', isPrimary: true },
{ name: 'log_index', type: 'integer', isPrimary: true },
{ name: 'block_timestamp', type: 'bigint' },
{ name: 'asset_descriptor', type: 'varchar' },
{ name: 'market_address', type: 'varchar(42)' },
{ name: 'total_price', type: 'numeric' },
{ name: 'usd_price', type: 'numeric' },
{ name: 'buyer_address', type: 'varchar(42)' },
{ name: 'seller_address', type: 'varchar(42)' },
{ name: 'meta', type: 'jsonb' },
],
});
export class CreateNftTrades1543540108767 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.createTable(nftTrades);
}
public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.dropTable(nftTrades);
}
}