aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations/src/migrate.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-25 07:18:44 +0800
committerGitHub <noreply@github.com>2018-05-25 07:18:44 +0800
commitc4a7574f7bd3939eac9417241144197bbb22edb1 (patch)
tree4f2d13872c3c8063373a56d1112c3f3ceb27f733 /packages/migrations/src/migrate.ts
parent4ee636ecca20d2744a7d133194aa950f3f6fb833 (diff)
parent3e907d7f4fddcb9ae5438b5676bf9ecd99007909 (diff)
downloaddexon-sol-tools-c4a7574f7bd3939eac9417241144197bbb22edb1.tar
dexon-sol-tools-c4a7574f7bd3939eac9417241144197bbb22edb1.tar.gz
dexon-sol-tools-c4a7574f7bd3939eac9417241144197bbb22edb1.tar.bz2
dexon-sol-tools-c4a7574f7bd3939eac9417241144197bbb22edb1.tar.lz
dexon-sol-tools-c4a7574f7bd3939eac9417241144197bbb22edb1.tar.xz
dexon-sol-tools-c4a7574f7bd3939eac9417241144197bbb22edb1.tar.zst
dexon-sol-tools-c4a7574f7bd3939eac9417241144197bbb22edb1.zip
Merge pull request #618 from 0xProject/feature/v2-migrations
Migrate migrations, types to v2
Diffstat (limited to 'packages/migrations/src/migrate.ts')
-rw-r--r--packages/migrations/src/migrate.ts19
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);