Socket
Socket
Sign inDemoInstall

db-migrate-shared

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db-migrate-shared - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

2

package.json
{
"name": "db-migrate-shared",
"version": "1.0.2",
"version": "1.1.0",
"description": "Shared resources of db-migrate for drivers and also used internally.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -12,5 +12,23 @@ var log = require('./log');

exports.filterUp = function(allMigrations, completedMigrations, destination, count) {
function isIncludedInDown(migration, destination) {
if(!destination) {
return true;
}
var migrationTest = migration.name.substring(0, Math.min(migration.name.length, destination.length));
var destinationTest = destination.substring(0, Math.min(migration.name.length, destination.length));
return migrationTest >= destinationTest;
}
function filterCompleted(allMigrations, completedMigrations) {
var sortFn = function(a, b) {
return a.name.slice(0, a.name.indexOf('-')) - b.name.slice(0, b.name.indexOf('-'));
a = a.name.slice(0, a.name.indexOf('-'));
b = b.name.slice(0, b.name.indexOf('-'));
if(!isNaN(a)) {
return a - b;
}
return a.localeCompare(b);
};

@@ -24,9 +42,34 @@

return !hasRun;
})
});
}
exports.filterUp = function(allMigrations, completedMigrations, destination, count) {
return filterCompleted(allMigrations, completedMigrations)
.filter(function(migration) {
return isIncludedInUp(migration, destination);
})
.slice(0, count);
}).slice(0, count);
};
exports.filterDown = function(completedMigrations, destination, count) {
return completedMigrations
.filter(function(migration) {
return isIncludedInDown(migration, destination);
}).slice(0, count);
};
exports.syncMode = function(completedMigrations, destination) {
var isDown = isIncludedInDown(
completedMigrations[completedMigrations.length -1],
destination
);
if(isDown)
return 1;
else
return 0;
};
/**

@@ -127,7 +170,2 @@ * Similar to the shadow driver, but we reduce to a subset of an existing

exports.filterDown = function(completedMigrations, count) {
return completedMigrations.slice(0, count);
};
exports.lpad = function(str, padChar, totalLength) {

@@ -134,0 +172,0 @@ str = str.toString();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc