aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations/src/migrate.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-25 01:56:31 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-25 04:59:30 +0800
commit92b0efff5abaac8bea468a1b3f897d004ec9c542 (patch)
tree61e976aa42b78e7eea12f73fb2ccc4a5ad1f9ceb /packages/migrations/src/migrate.ts
parent62431fee8e0c79a61f7ebb7677e6c88f0ae95116 (diff)
downloaddexon-sol-tools-92b0efff5abaac8bea468a1b3f897d004ec9c542.tar
dexon-sol-tools-92b0efff5abaac8bea468a1b3f897d004ec9c542.tar.gz
dexon-sol-tools-92b0efff5abaac8bea468a1b3f897d004ec9c542.tar.bz2
dexon-sol-tools-92b0efff5abaac8bea468a1b3f897d004ec9c542.tar.lz
dexon-sol-tools-92b0efff5abaac8bea468a1b3f897d004ec9c542.tar.xz
dexon-sol-tools-92b0efff5abaac8bea468a1b3f897d004ec9c542.tar.zst
dexon-sol-tools-92b0efff5abaac8bea468a1b3f897d004ec9c542.zip
Migrate migrations 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);