(attributes, options)
| 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'); |
no test coverage detected