sails-disk
Advanced tools
Comparing version 0.10.4 to 0.10.5
@@ -190,3 +190,3 @@ /** | ||
schema: self.schema, | ||
counters: self.schema | ||
counters: self.counters | ||
}); | ||
@@ -207,2 +207,9 @@ | ||
// Cast values when reading off of disk. Essentially, unserialize the records. | ||
for (var collectionName in state.data) { | ||
state.data[collectionName].map(function (values) { | ||
self.collections[collectionName]._cast.run(values); | ||
}); | ||
} | ||
self.data = state.data; | ||
@@ -506,15 +513,26 @@ self.schema = state.schema; | ||
var attrDef = this.schema[collectionName][attrName]; | ||
// Only apply autoIncrement if value is not specified | ||
// Only apply autoIncrement if we're supposed to! | ||
if(!attrDef.autoIncrement) continue; | ||
if(values[attrName]) continue; | ||
// Set Initial Counter Value to 0 for this attribute if not set | ||
// Set initial counter value to 0 for this attribute if not set | ||
if(!this.counters[collectionName][attrName]) this.counters[collectionName][attrName] = 0; | ||
// Increment AI counter | ||
this.counters[collectionName][attrName]++; | ||
// Set data to current auto-increment value | ||
values[attrName] = this.counters[collectionName][attrName]; | ||
// If peeps are manually setting the AI field, keep the counter ahead. | ||
// Otherwise, increment the counter and set the field. | ||
if(values[attrName]) { | ||
if (values[attrName] > this.counters[collectionName][attrName]) { | ||
this.counters[collectionName][attrName] = values[attrName]; | ||
} | ||
} else { | ||
// Increment AI counter | ||
this.counters[collectionName][attrName]++; | ||
// Set data to current auto-increment value | ||
values[attrName] = this.counters[collectionName][attrName]; | ||
} | ||
} | ||
@@ -521,0 +539,0 @@ |
{ | ||
"name": "sails-disk", | ||
"version": "0.10.4", | ||
"version": "0.10.5", | ||
"description": "Persistent local-disk adapter for Sails.js / Waterline", | ||
@@ -32,7 +32,7 @@ "main": "lib/adapter.js", | ||
"lodash": "~2.4.1", | ||
"waterline-criteria": "~0.10.7", | ||
"waterline-criteria": "~0.11.0", | ||
"waterline-errors": "~0.10.0", | ||
"fs-extra": "~0.8.1", | ||
"async": "~0.2.9", | ||
"waterline-cursor": "~0.0.3" | ||
"waterline-cursor": "~0.0.5" | ||
}, | ||
@@ -39,0 +39,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31283
865
+ Addedwaterline-criteria@0.11.2(transitive)
- Removedinclude-all@0.1.6(transitive)
- Removedunderscore.string@2.3.1(transitive)
- Removedwaterline-criteria@0.10.7(transitive)
Updatedwaterline-criteria@~0.11.0
Updatedwaterline-cursor@~0.0.5