@vbilopav/pgmigrations
Advanced tools
Comparing version 0.19.0 to 0.20.0
@@ -38,2 +38,4 @@ const crypto = require('crypto'); | ||
dirsOrderedByName: true, | ||
dirsOrderedBySegments: true, | ||
dirsOrderedBySegmentsDesc: true, | ||
keepMigrationDirHistory: false, | ||
@@ -40,0 +42,0 @@ tmpDir: path.join(os.tmpdir(), "___pgmigrations"), |
@@ -497,7 +497,16 @@ const path = require("path"); | ||
const pathB = getDirectoryPath(b.script); | ||
const segmentsA = a.script.split('/').length; | ||
const segmentsB = b.script.split('/').length; | ||
if (segmentsA !== segmentsB) { | ||
return segmentsA > segmentsB ? -1 : 1; | ||
if (config.dirsOrderedBySegments) { | ||
const segmentsA = a.script.split('/').length; | ||
const segmentsB = b.script.split('/').length; | ||
if (segmentsA !== segmentsB) { | ||
if (config.dirsOrderedBySegmentsDesc) { | ||
return segmentsA > segmentsB ? -1 : 1; | ||
} else { | ||
return segmentsA > segmentsB ? 1 : -1; | ||
} | ||
} | ||
} | ||
if (pathA !== pathB) { | ||
return pathA.localeCompare(pathB); | ||
} | ||
return a.originalIndex - b.originalIndex; | ||
@@ -504,0 +513,0 @@ }); |
{ | ||
"name": "@vbilopav/pgmigrations", | ||
"version": "0.19.0", | ||
"version": "0.20.0", | ||
"description": "PostgreSQL Migration Tool for Node.js and NPM", | ||
@@ -5,0 +5,0 @@ "author": "vb-consulting", |
@@ -329,2 +329,10 @@ # PgMigrations | ||
#### dirsOrderedBySegments | ||
When `dirsOrderedByName` is true, order directories first by number of directory segments. Default is true (same order as VSC). | ||
#### dirsOrderedBySegmentsDesc | ||
When `dirsOrderedByName` is true, and `dirsOrderedBySegments` is also true, order directories first by number of directory segments descending. This will put files in lower directories last. Default is true (same order as VSC). | ||
#### tmpDir | ||
@@ -331,0 +339,0 @@ |
78617
1395
495