diff --git a/package-lock.json b/package-lock.json index 5436b7c..972b919 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "onetable-migrate", - "version": "1.0.3", + "version": "1.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.0.3", + "version": "1.0.4", "license": "MIT", "dependencies": { "dynamodb-onetable": "^1.5.6", diff --git a/package.json b/package.json index b058623..d1db91b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onetable-migrate", - "version": "1.0.3", + "version": "1.0.4", "description": "DynamoDB OneTable Migration Library", "main": "dist/cjs/index.js", "module": "dist/mjs/index.js", diff --git a/src/index.js b/src/index.js index 9856109..59198a1 100644 --- a/src/index.js +++ b/src/index.js @@ -66,6 +66,7 @@ export class Migrate { await migration.down(this.db, this) await this.Migration.remove({version: migration.version}) } else { + // Repeat and up await migration.up(this.db, this) let params = { version, @@ -73,7 +74,11 @@ export class Migrate { path: migration.path, description: migration.description, } - await this.Migration.create(params) + if (direction == 1) { + await this.Migration.create(params) + } else { + await this.Migration.update(params) + } } } return migration