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

knex

Package Overview
Dependencies
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

6

clients/base.js

@@ -84,7 +84,7 @@ var nodefn = require('when/node/function');

finishTransaction: function(type, trans, dfd) {
finishTransaction: function(type, trans, dfd, msg) {
var ctx = this;
nodefn.call(trans.connection.query.bind(trans.connection), type + ';', []).then(function(resp) {
if (type === 'commit') dfd.resolve(resp);
if (type === 'rollback') dfd.reject(resp);
if (type === 'commit') dfd.resolve(msg || resp);
if (type === 'rollback') dfd.reject(msg || resp);
}).ensure(function() {

@@ -91,0 +91,0 @@ ctx.releaseConnection(trans.connection);

@@ -87,3 +87,3 @@ var When = require('when');

// The possible column modifiers.
modifiers: ['Unsigned', 'Nullable', 'Default', 'Increment', 'After'],
modifiers: ['Unsigned', 'Nullable', 'Default', 'Increment', 'After', 'Comment'],

@@ -102,2 +102,7 @@ // Compile a create table command.

if (blueprint.tableComment) {
var maxTableCommentLength = 60;
sql += " comment = '" + blueprint.tableComment + "'"
}
return sql;

@@ -256,4 +261,12 @@ },

}
},
// Get the SQL for a comment column modifier. (MySQL)
modifyComment: function(blueprint, column) {
var maxColumnCommentLength = 255;
if (_.isString(column.comment)) {
return " comment '" + column.comment + "'";
}
}
});

@@ -172,2 +172,21 @@ var When = require('when');

// Compile a comment command.
compileComment: function(blueprint, command) {
var table = this.wrapTable(blueprint);
var comment;
if (command.comment == void 0) {
comment = 'NULL'
} else {
comment = "'" + command.comment + "'";
}
var identifier;
if (command.isTable) {
identifier = 'table ' + table;
} else {
var column = this.wrap(command.columnName);
identifier = 'column ' + table + '.' + column;
}
return 'comment on ' + identifier + ' is ' + comment;
},
// Create the column definition for a string type.

@@ -239,2 +258,2 @@ typeString: function(column) {

}
});
});

@@ -90,7 +90,7 @@ var When = require('when');

finishTransaction: function(type, trans, dfd) {
finishTransaction: function(type, trans, dfd, msg) {
var ctx = this;
nodefn.call(trans.connection.run.bind(trans.connection), type + ';', []).then(function(resp) {
if (type === 'commit') dfd.resolve(resp);
if (type === 'rollback') dfd.reject(resp);
if (type === 'commit') dfd.resolve(msg || resp);
if (type === 'rollback') dfd.reject(msg || resp);
}).ensure(function() {

@@ -214,3 +214,3 @@ ctx.releaseConnection(trans.connection);

getCommandsByName: function(blueprint, name) {
return _.where(blueprint.commands, function(value) { return value.name == name; });
return _.find(blueprint.commands, function(value) { return value.name == name; }) || [];
},

@@ -217,0 +217,0 @@

@@ -1,2 +0,2 @@

// Knex.js 0.1.7
// Knex.js 0.1.8
//

@@ -26,8 +26,4 @@ // (c) 2013 Tim Griesser

// Keep in sync with package.json
Knex.VERSION = '0.1.7';
Knex.VERSION = '0.1.8';
var rethrower = function(err) {
throw err;
};
// Methods common to both the `Grammar` and `SchemaGrammar` interfaces,

@@ -447,3 +443,3 @@ // used to generate the sql in one form or another.

// All operators used in the `where` clause generation.
var operators = ['=', '<', '>', '<=', '>=', '<>', 'like', 'not like', 'between', 'ilike'];
var operators = ['=', '<', '>', '<=', '>=', '<>', '!=', 'like', 'not like', 'between', 'ilike'];

@@ -954,15 +950,19 @@ _.extend(Builder.prototype, Common, {

// Call the container with the transaction
// commit & rollback objects
container({
commit: function() {
client.finishTransaction('commit', this, dfd);
// Ensure the transacting object methods are bound with the correct context.
var containerObj = {
commit: function(msg) {
client.finishTransaction('commit', this, dfd, msg);
},
rollback: function() {
client.finishTransaction('rollback', this, dfd);
rollback: function(msg) {
client.finishTransaction('rollback', this, dfd, msg);
},
// "rollback to"?
connection: connection
});
};
_.bindAll(containerObj, 'commit', 'rollback');
// Call the container with the transaction
// commit & rollback objects.
container(containerObj);
return dfd.promise;

@@ -1093,2 +1093,22 @@ });

// Add table comments. (Postgres)
if (this.tableComment) {
this._addCommand('comment', {
comment: this.tableComment,
isTable: true
});
}
// Add column comments. (Postgres)
for (var i = 0, l = this.columns.length; i < l; i++) {
var column = this.columns[i];
if (_.has(column, 'comment')) {
this._addCommand('comment', {
comment: column.comment,
columnName: column.name,
isTable: false
});
}
}
var statements = [];

@@ -1177,2 +1197,6 @@

comment: function(comment) {
this.tableComment = comment || null;
},
// Create a new auto-incrementing column on the table.

@@ -1385,2 +1409,8 @@ increments: function(column) {

return this;
},
// Adds a comment to this column.
comment: function(comment) {
this.comment = comment || null;
return this;
}

@@ -1627,2 +1657,2 @@

}).call(this);
}).call(this);
{
"name": "knex",
"version": "0.1.7",
"version": "0.1.8",
"description": "A query builder for Postgres, MySQL and SQLite3, designed to be flexible, portable, and fun to use.",

@@ -31,8 +31,5 @@ "main": "knex.js",

"query",
"builder",
"postgresql",
"postgres",
"mysql",
"sqlite3",
"sqlite"
"sqlite3"
],

@@ -39,0 +36,0 @@ "author": {

@@ -18,2 +18,3 @@ var When = require('when');

table.engine('InnoDB');
table.comment('A table comment.')
table.increments('id');

@@ -23,4 +24,4 @@ table.string('first_name');

table.string('email').unique().nullable();
table.integer('logins').defaultTo(1).index();
table.text('about');
table.integer('logins').defaultTo(1).index().comment();
table.text('about').comment('A comment.');
table.timestamps();

@@ -72,2 +73,2 @@ }),

};
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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