@vbilopav/pgmigrations
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -225,2 +225,3 @@ const path = require("path"); | ||
var parsedDirs = {}; | ||
var usedNames = {}; | ||
for (let i = 0; i < migrationDirs.length; i++) { | ||
@@ -272,4 +273,15 @@ const migrationDir = migrationDirs[i]; | ||
let name = (hasMultipleDirs ? (migrationDir + " " + suffix.split(".").slice(0, -1).join(".")) : suffix.split(".").slice(0, -1).join(".")).trim(); | ||
name = name.replace(/[^a-zA-Z0-9]/g, " ").trim().replace(/\s+/g, " "); | ||
let name = suffix.split(".").slice(0, -1).join(".").replace(/[^a-zA-Z0-9]/g, " ").trim().replace(/\s+/g, " "); | ||
if (usedNames[name]) { | ||
let dirParts = migrationDir.replace(/[^a-zA-Z0-9]/g, " ").trim().split(" "); | ||
name = name + " (" + dirParts[dirParts.length-1] + ")"; | ||
if (usedNames[name]) { | ||
name = name + " (" + dirParts.join("/") + ")"; | ||
} | ||
if (usedNames[name]) { | ||
warning(`Migration file ${migrationDir}/${fileName} contains duplicate name ${name}. Skipping...`); | ||
return; | ||
} | ||
} | ||
usedNames[name] = true; | ||
@@ -276,0 +288,0 @@ let version = null; |
{ | ||
"name": "@vbilopav/pgmigrations", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "PostgreSQL Migration Tool for Node.js and NPM", | ||
@@ -5,0 +5,0 @@ "author": "vb-consulting", |
65539
1194