diff options
Diffstat (limited to 'packages/migrations/src/migrate.ts')
-rw-r--r-- | packages/migrations/src/migrate.ts | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts index 1230f376e..49b4e897c 100644 --- a/packages/migrations/src/migrate.ts +++ b/packages/migrations/src/migrate.ts @@ -3,8 +3,16 @@ import { devConstants, web3Factory } from '@0xproject/dev-utils'; import { Provider } from '@0xproject/types'; import { logUtils } from '@0xproject/utils'; import * as path from 'path'; +import * as yargs from 'yargs'; -import { runMigrationsAsync } from './migration'; +import { runV1MigrationsAsync } from './v1/migration'; +import { runV2MigrationsAsync } from './v2/migration'; + +enum ContractVersions { + V1 = '1.0.0', + V2 = '2.0.0', +} +const args = yargs.argv; (async () => { const txDefaults = { @@ -12,8 +20,13 @@ import { runMigrationsAsync } from './migration'; }; const providerConfigs = { shouldUseInProcessGanache: false }; const provider: Provider = web3Factory.getRpcProvider(providerConfigs); - const artifactsDir = 'artifacts/1.0.0'; - await runMigrationsAsync(provider, artifactsDir, txDefaults); + const contractsVersion = args.contractsVersion; + const artifactsDir = `artifacts/${contractsVersion}`; + if (contractsVersion === ContractVersions.V1) { + await runV1MigrationsAsync(provider, artifactsDir, txDefaults); + } else { + await runV2MigrationsAsync(provider, artifactsDir, txDefaults); + } process.exit(0); })().catch(err => { logUtils.log(err); |