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

bookshelf

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bookshelf - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

5

bookshelf.js

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

// Bookshelf.js 0.5.1
// Bookshelf.js 0.5.2
// ---------------

@@ -85,3 +86,3 @@ // (c) 2013 Tim Griesser

// Keep in sync with `package.json`.
VERSION: '0.5.1',
VERSION: '0.5.2',

@@ -88,0 +89,0 @@ // Helper method to wrap a series of Bookshelf actions in a `knex` transaction block;

2

dialects/base/sync.js

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

// Sync
// Base Sync
// ---------------

@@ -3,0 +3,0 @@ (function(define) {

@@ -37,3 +37,4 @@ // Relation

this.target = Helpers.morphCandidate(this.candidates, parent.get(this.key('morphKey')));
this.targetTableName = _.result(this.target.prototype, 'tableName');
this.targetTableName = _.result(this.target.prototype, 'tableName');
this.targetIdAttribute = _.result(this.target.prototype, 'idAttribute');
}

@@ -183,3 +184,3 @@ this.parentFk = parent.get(this.key('foreignKey'));

} else {
key = this.isInverse() ? this.parentIdAttribute : this.key('foreignKey');
key = this.isInverse() ? this.targetIdAttribute : this.key('foreignKey');
}

@@ -186,0 +187,0 @@

{
"name": "bookshelf",
"version": "0.5.1",
"version": "0.5.2",
"description": "A lightweight ORM for PostgreSQL, MySQL, and SQLite3, influenced by Backbone.js",

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

@@ -197,5 +197,15 @@ var when = require('when');

{id: 2, Customer_id: 4, data: 'UTC'}
]),
knex('hostnames').insert([
{hostname: 'google.com', instance_id: 3},
{hostname: 'apple.com', instance_id: 10},
]),
knex('instances').insert([
{id: 3, name: 'search engine'},
{id: 4, name: 'not used'},
{id: 10, name: 'computers'},
])
]).then(null, function(e) {

@@ -202,0 +212,0 @@ console.log(e.stack);

@@ -8,3 +8,4 @@ var _ = require('underscore');

'blogs', 'posts', 'tags', 'posts_tags', 'comments',
'users', 'roles', 'photos', 'users_roles', 'info', 'Customer', 'Settings'
'users', 'roles', 'photos', 'users_roles', 'info',
'Customer', 'Settings', 'hostnames', 'instances'
];

@@ -131,2 +132,13 @@

table.string('data', 64);
}),
schema.createTable('hostnames', function(table){
table.string('hostname');
table.integer('instance_id');
table.enu('route', ['annotate','submit']);
}),
schema.createTable('instances', function(table){
table.bigIncrements('id');
table.string('name');
})

@@ -133,0 +145,0 @@

@@ -184,3 +184,2 @@

// Define the model
var Settings = Bookshelf.Model.extend({ tableName: 'Settings' });

@@ -195,2 +194,17 @@

var Hostname = Bookshelf.Model.extend({
tableName: 'hostnames',
idAttribute: 'hostname',
instance: function() {
return this.belongsTo(Instance);
}
});
var Instance = Bookshelf.Model.extend({
tableName: 'instances',
hostnames: function() {
return this.hasMany(Hostname);
}
});
return {

@@ -211,3 +225,5 @@ Models: {

Customer: Customer,
Settings: Settings
Settings: Settings,
Instance: Instance,
Hostname: Hostname
},

@@ -214,0 +230,0 @@ Collections: {

@@ -26,2 +26,4 @@ var when = require('when');

var Customer = Models.Customer;
var Instance = Models.Instance;
var Hostname = Models.Hostname;

@@ -393,4 +395,20 @@ // Collections

describe('Issue #65, custom idAttribute with eager loaded belongsTo', function() {
it('#65 - should eager load correctly for models', function() {
return new Hostname({hostname: 'google.com'}).fetch({log: true, withRelated: 'instance'});
});
it('#65 - should eager load correctly for collections', function() {
return new Bookshelf.Collection([], {model: Hostname}).fetch({log: true, withRelated: 'instance'});
});
});
});
};

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