MCPcopy
hub / github.com/sequelize/sequelize / attributesToSQL

Method attributesToSQL

lib/dialects/db2/query-generator.js:665–693  ·  lib/dialects/db2/query-generator.js::Db2QueryGenerator.attributesToSQL
(attributes, options)

Source from the content-addressed store, hash-verified

663 }
664
665 attributesToSQL(attributes, options) {
666 const result = {},
667 existingConstraints = [];
668 let key,
669 attribute;
670
671 for (key in attributes) {
672 attribute = attributes[key];
673
674 if (attribute.references) {
675
676 if (existingConstraints.indexOf(attribute.references.model.toString()) !== -1) {
677 class="cm">// no cascading constraints to a table more than once
678 attribute.onDelete = class="st">'';
679 attribute.onUpdate = class="st">'';
680 } else if (attribute.unique && attribute.unique === true) {
681 attribute.onDelete = class="st">'';
682 attribute.onUpdate = class="st">'';
683 } else {
684 existingConstraints.push(attribute.references.model.toString());
685 }
686 }
687
688 if (key && !attribute.field && typeof attribute === class="st">'object') attribute.field = key;
689 result[attribute.field || key] = this.attributeToSQL(attribute, options);
690 }
691
692 return result;
693 }
694
695 createTrigger() {
696 throwMethodUndefined(class="st">'createTrigger');

Callers 7

createTableMethod · 0.45
changeColumnMethod · 0.45
renameColumnMethod · 0.45
createTableMethod · 0.45

Calls 2

attributeToSQLMethod · 0.95
toStringMethod · 0.65

Tested by

no test coverage detected