不要怂,就是干,撸起袖子干!

Commit dd4ceb85 by Joe Lutz

Add attribute.field support for sync()

1 parent 3970bf71
...@@ -245,6 +245,7 @@ module.exports = (function() { ...@@ -245,6 +245,7 @@ module.exports = (function() {
for (var name in attributes) { for (var name in attributes) {
var dataType = attributes[name]; var dataType = attributes[name];
var fieldName = dataType.field || name;
if (Utils._.isPlainObject(dataType)) { if (Utils._.isPlainObject(dataType)) {
var template; var template;
...@@ -305,9 +306,9 @@ module.exports = (function() { ...@@ -305,9 +306,9 @@ module.exports = (function() {
} }
result[name] = template; result[fieldName] = template;
} else { } else {
result[name] = dataType; result[fieldName] = dataType;
} }
} }
......
...@@ -391,6 +391,7 @@ module.exports = (function() { ...@@ -391,6 +391,7 @@ module.exports = (function() {
for (var name in attributes) { for (var name in attributes) {
var dataType = attributes[name]; var dataType = attributes[name];
var fieldName = dataType.field || name;
if (Utils._.isObject(dataType)) { if (Utils._.isObject(dataType)) {
var template = '<%= type %>' var template = '<%= type %>'
...@@ -467,9 +468,9 @@ module.exports = (function() { ...@@ -467,9 +468,9 @@ module.exports = (function() {
replacements.comment = this.escape(dataType.comment); replacements.comment = this.escape(dataType.comment);
} }
result[name] = Utils._.template(template)(replacements); result[fieldName] = Utils._.template(template)(replacements);
} else { } else {
result[name] = dataType; result[fieldName] = dataType;
} }
} }
......
...@@ -232,6 +232,7 @@ module.exports = (function() { ...@@ -232,6 +232,7 @@ module.exports = (function() {
for (var name in attributes) { for (var name in attributes) {
var dataType = attributes[name]; var dataType = attributes[name];
var fieldName = dataType.field || name;
if (Utils._.isObject(dataType)) { if (Utils._.isObject(dataType)) {
var template = "<%= type %>" var template = "<%= type %>"
...@@ -291,9 +292,9 @@ module.exports = (function() { ...@@ -291,9 +292,9 @@ module.exports = (function() {
} }
result[name] = Utils._.template(template)(replacements); result[fieldName] = Utils._.template(template)(replacements);
} else { } else {
result[name] = dataType; result[fieldName] = dataType;
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!