Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

anydb-sql-migrations

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anydb-sql-migrations - npm Package Compare versions

Comparing version 2.1.6 to 2.2.0

.idea/.name

36

lib/index.js
"use strict";
exports.__esModule = true;
var Promise = require("bluebird");

@@ -42,3 +41,3 @@ var _ = require("lodash");

function remove(tx, name) {
return migrations.where({ version: name })["delete"]().execWithin(tx);
return migrations.where({ version: name }).delete().execWithin(tx);
}

@@ -89,3 +88,6 @@ function runSingle(tx, type, m) {

var args = require('yargs').argv;
if (args.check)
return execMigrations(args).then(function () { return process.exit(0); }).catch(function (e) { return process.exit(1); });
}
function execMigrations(migrationOptions) {
if (migrationOptions.check)
return check(function (migrations) {

@@ -95,16 +97,16 @@ if (migrations.length) {

migrations.forEach(function (item) { return console.log("-", item.name); });
process.exit(1);
return Promise.resolve();
}
else {
console.log("No pending migrations");
process.exit(0);
return Promise.resolve();
}
});
else if (args.execute)
return migrate().done(function (_) { return process.exit(0); }, function (e) {
else if (migrationOptions.execute)
return migrate().done(function (_) { return Promise.resolve(); }, function (e) {
console.error(e.stack);
process.exit(1);
return Promise.reject(e);
});
else if (args.rollback) {
return undoLast().done(function (_) { return process.exit(0); }, function (e) {
else if (migrationOptions.rollback) {
return undoLast().done(function (_) { return Promise.resolve(); }, function (e) {
if (e.message == 'No migrations available to rollback') {

@@ -116,7 +118,7 @@ console.error(e.message);

}
process.exit(1);
return Promise.reject(e);
});
}
else if (args.drop) {
return undoAll().done(function (_) { return process.exit(0); }, function (e) {
else if (migrationOptions.drop) {
return undoAll().done(function (_) { return Promise.resolve(); }, function (e) {
if (e.message == 'No migrations available to rollback') {

@@ -128,7 +130,8 @@ console.error(e.message);

}
process.exit(1);
return Promise.reject(e);
});
}
console.error("Add a --check, --execute, --drop or --rollback argument");
process.exit(1);
var wrontArgumentMessage = "Add a --check, --execute, --drop or --rollback argument";
console.error(wrontArgumentMessage);
return Promise.resolve(new Error(wrontArgumentMessage));
}

@@ -142,2 +145,1 @@ if (typeof tasks === 'string')

exports.create = create;
//# sourceMappingURL=index.js.map
{
"name": "anydb-sql-migrations",
"version": "2.1.6",
"version": "2.2.0",
"description": "Database migrations for anydb-sql",

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

@@ -53,4 +53,12 @@ ## anydb-sql-migrations

If you want to run the migrations from JavaScript code instead of cli, you can pass `{ execute: true }` to `run` function
```js
require('anydb-sql-migrate')
.create(myanydbsql, '/path/to/migrations/dir')
.run({ execute: true }); // will use this argument instead of reading from process.argv
```
# license
MIT

Sorry, the diff of this file is not supported yet

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