node-pg-migrate
Advanced tools
Comparing version 6.1.0 to 6.2.0
# Change Log | ||
## [6.2.0](2021-12-17) | ||
- gh-754: Allow undefined count [#791](https://github.com/salsita/node-pg-migrate/pull/791) | ||
## [6.1.0](2021-12-17) | ||
### Added | ||
- gh-857: Add unique option to drop index [#858](https://github.com/salsita/node-pg-migrate/pull/858) | ||
- gh-813: Stabilize sort for migration files [#818](https://github.com/salsita/node-pg-migrate/pull/818) | ||
## [6.0.0](2021-09-20) | ||
@@ -4,0 +15,0 @@ |
@@ -87,5 +87,6 @@ "use strict"; | ||
.map((migrationName) => migrations.find(({ name }) => name === migrationName) || migrationName); | ||
const { count = 1 } = options; | ||
const toRun = (options.timestamp | ||
? downMigrations.filter((migration) => typeof migration === 'object' && migration.timestamp >= options.count) | ||
: downMigrations.slice(-Math.abs(options.count === undefined ? 1 : options.count))).reverse(); | ||
? downMigrations.filter((migration) => typeof migration === 'object' && migration.timestamp >= count) | ||
: downMigrations.slice(-Math.abs(count))).reverse(); | ||
const deletedMigrations = toRun.filter((migration) => typeof migration === 'string'); | ||
@@ -99,5 +100,6 @@ if (deletedMigrations.length) { | ||
const upMigrations = migrations.filter(({ name }) => runNames.indexOf(name) < 0 && (!options.file || options.file === name)); | ||
const { count = Infinity } = options; | ||
return options.timestamp | ||
? upMigrations.filter(({ timestamp }) => timestamp <= options.count) | ||
: upMigrations.slice(0, Math.abs(options.count === undefined ? Infinity : options.count)); | ||
? upMigrations.filter(({ timestamp }) => timestamp <= count) | ||
: upMigrations.slice(0, Math.abs(count)); | ||
}; | ||
@@ -104,0 +106,0 @@ const checkOrder = (runNames, migrations) => { |
@@ -222,3 +222,3 @@ import { ClientBase, ClientConfig, QueryArrayResult, QueryResult, QueryArrayConfig, QueryConfig } from 'pg'; | ||
*/ | ||
count: number; | ||
count?: number; | ||
/** | ||
@@ -225,0 +225,0 @@ * Treats `count` as timestamp. |
{ | ||
"name": "node-pg-migrate", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"description": "Postgresql database migration management tool for node.js", | ||
@@ -5,0 +5,0 @@ "author": "Theo Ephraim", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
293647
3586