@ovotech/pg-sql-migrate
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -33,9 +33,8 @@ "use strict"; | ||
logger.info(`Executing [${migration.id}] ${migration.name}`); | ||
if (exports.isTransactionDisabled(migration.content)) { | ||
await db.query(migration.content); | ||
if (!exports.isTransactionDisabled(migration.content)) { | ||
await db.query('BEGIN'); | ||
} | ||
else { | ||
await db.query('BEGIN'); | ||
await db.query(migration.content); | ||
await db.query(`INSERT INTO ${db.escapeIdentifier(table)} VALUES ($1);`, [migration.id]); | ||
await db.query(migration.content); | ||
await db.query(`INSERT INTO ${db.escapeIdentifier(table)} VALUES ($1);`, [migration.id]); | ||
if (!exports.isTransactionDisabled(migration.content)) { | ||
await db.query('COMMIT'); | ||
@@ -42,0 +41,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"repository": "git@github.com:ovotech/pg-sql-migrate.git", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"main": "dist/index.js", | ||
@@ -8,0 +8,0 @@ "types": "dist/index.d.ts", |
@@ -66,8 +66,8 @@ import { loadConfigFile } from '@ovotech/config-file'; | ||
logger.info(`Executing [${migration.id}] ${migration.name}`); | ||
if (isTransactionDisabled(migration.content)) { | ||
await db.query(migration.content); | ||
} else { | ||
if (!isTransactionDisabled(migration.content)) { | ||
await db.query('BEGIN'); | ||
await db.query(migration.content); | ||
await db.query(`INSERT INTO ${db.escapeIdentifier(table)} VALUES ($1);`, [migration.id]); | ||
} | ||
await db.query(migration.content); | ||
await db.query(`INSERT INTO ${db.escapeIdentifier(table)} VALUES ($1);`, [migration.id]); | ||
if (!isTransactionDisabled(migration.content)) { | ||
await db.query('COMMIT'); | ||
@@ -74,0 +74,0 @@ } |
Sorry, the diff of this file is not supported yet
35911
591