Configure TypeORM for migrations. Add new package.json scripts.

This commit is contained in:
Alex Browne
2018-11-12 16:40:20 -08:00
parent 6fb333f200
commit 329c68f610
6 changed files with 21 additions and 30 deletions

View File

@@ -2,11 +2,11 @@ import { web3Factory } from '@0x/dev-utils';
import { Web3ProviderEngine } from '@0x/subproviders';
import R = require('ramda');
import 'reflect-metadata';
import { Connection, createConnection, Repository } from 'typeorm';
import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
import { ExchangeEventsSource } from '../data_sources/contract-wrappers/exchange_events';
import { ExchangeFillEvent } from '../entities';
import { deployConfig } from '../ormconfig';
import * as ormConfig from '../ormconfig';
import { parseExchangeEvents } from '../parsers/events';
import { handleError } from '../utils';
@@ -17,7 +17,7 @@ const BATCH_SAVE_SIZE = 1000; // Number of events to save at once.
let connection: Connection;
(async () => {
connection = await createConnection(deployConfig);
connection = await createConnection(ormConfig as ConnectionOptions);
const provider = web3Factory.getRpcProvider({
rpcUrl: 'https://mainnet.infura.io',
});

View File

@@ -1,9 +1,9 @@
import 'reflect-metadata';
import { Connection, createConnection } from 'typeorm';
import { Connection, ConnectionOptions, createConnection } from 'typeorm';
import { RelayerRegistrySource } from '../data_sources/relayer-registry';
import { Relayer } from '../entities';
import { deployConfig } from '../ormconfig';
import * as ormConfig from '../ormconfig';
import { parseRelayers } from '../parsers/relayer_registry';
import { handleError } from '../utils';
@@ -15,7 +15,7 @@ const RELAYER_REGISTRY_URL =
let connection: Connection;
(async () => {
connection = await createConnection(deployConfig);
connection = await createConnection(ormConfig as ConnectionOptions);
await getRelayers();
process.exit(0);
})().catch(handleError);