waterline
Advanced tools
Comparing version 0.10.0-rc1 to 0.10.0-rc2
@@ -60,3 +60,2 @@ /** | ||
* | ||
* | ||
* @param {Array} ordered | ||
@@ -63,0 +62,0 @@ * @return {Object} |
@@ -42,4 +42,3 @@ /** | ||
this.hasSchema = Object.getPrototypeOf(this).hasOwnProperty('schema') ? | ||
this.schema : true; | ||
this.hasSchema = Core._normalizeSchemaFlag.call(this); | ||
@@ -107,1 +106,35 @@ this.migrate = Object.getPrototypeOf(this).hasOwnProperty('migrate') ? | ||
}; | ||
/** | ||
* Normalize Schema Flag | ||
* | ||
* Normalize schema setting by looking at the model first to see if it is defined, if not look at | ||
* the connection and see if it's defined and if not finally look into the adapter and check if | ||
* there is a default setting. If not found anywhere be safe and set to true. | ||
* | ||
* @api private | ||
* @return {Boolean} | ||
*/ | ||
Core._normalizeSchemaFlag = function() { | ||
// If schema is defined on the collection, return the value | ||
if(hasOwnProperty(Object.getPrototypeOf(this), 'schema')) { | ||
return Object.getPrototypeOf(this).schema; | ||
} | ||
// Grab the first connection used | ||
if(!this.connection || !Array.isArray(this.connection)) return true; | ||
var connection = this.connections[this.connection[0]]; | ||
// Check the user defined config | ||
if(hasOwnProperty(connection, 'config') && hasOwnProperty(connection.config, 'schema')) { | ||
return connection.config.schema; | ||
} | ||
// Check the defaults defined in the adapter | ||
if(!hasOwnProperty(connection, '_adapter')) return true; | ||
if(!hasOwnProperty(connection._adapter, 'schema')) return true; | ||
return connection._adapter.schema; | ||
}; |
@@ -154,3 +154,3 @@ /** | ||
attr.type = type; | ||
attr.type = type.toLowerCase(); | ||
attr.model = value[key].toLowerCase(); | ||
@@ -157,0 +157,0 @@ attr.foreignKey = true; |
@@ -343,3 +343,3 @@ | ||
if(!hasOwnProperty(attr, 'references')) continue; | ||
var attrCollection = attr.references.toLowerCase(); | ||
var attrCollection = attr.references; | ||
@@ -346,0 +346,0 @@ if(attrCollection !== identity) { |
@@ -122,11 +122,11 @@ /** | ||
var self = this, | ||
attr, | ||
joinKey = false, | ||
usedInJoin; | ||
var self = this; | ||
// Look at each key in the object and see if it was used in a join | ||
Object.keys(value).forEach(function(key) { | ||
var joinKey = false, | ||
attr, | ||
usedInJoin; | ||
// If showJoins wasn't set or no joins were found there is nothing to modelize | ||
@@ -133,0 +133,0 @@ if(!self.options.showJoins || !self.options.joins) return; |
{ | ||
"name": "waterline", | ||
"description": "An ORM for Node.js and the Sails framework", | ||
"version": "0.10.0-rc1", | ||
"version": "0.10.0-rc2", | ||
"homepage": "http://github.com/balderdashy/waterline", | ||
@@ -25,3 +25,3 @@ "contributors": [ | ||
"q": "~0.9.7", | ||
"waterline-schema": "~0.1.0", | ||
"waterline-schema": "~0.1.1", | ||
"node-switchback": "~0.0.4" | ||
@@ -28,0 +28,0 @@ }, |
@@ -9,5 +9,5 @@ ![image_squidhome@2x.png](http://i.imgur.com/7rMxw.png) | ||
It provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get users, whether they live in MySQL, LDAP, MongoDB, or Facebook. | ||
It provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get and store things like users, whether they live in Redis, mySQL, LDAP, MongoDB, or Postgres. | ||
At the same time, Waterline aims to learn lessons and maintain the best features from both Rails' ActiveRecord and Grails' Hibernate ORMs. | ||
Waterline strives to inherit the best parts of ORMs like ActiveRecord, Hibernate, and Mongoose, but with a fresh perspective and emphasis on modularity, testability, and consistency across adapters. | ||
@@ -14,0 +14,0 @@ ## Installation |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
1
0
257357
79
6779
Updatedwaterline-schema@~0.1.1