index.html 1.52 KB
{% autoescape false %}
/*jslint node: true */
"use strict";

{%- if warning %}
/*------------------------------------------------------------------------------------

DO NOT EDIT THIS FILE !!! It is generated automatically and will be overwritten.

To modify this model:
1. Create '{{ table.baseFileName }}.js' file in 'definition-files-custom' directory located in this file's parent directory.
2. Copy the code below and paste it into '{{ table.baseFileName }}.js'.
3. Use utility methods to easily access orm properties.

"use strict";
var orm     = require('{{mainScript}}'),
    model   = require('./{{ table.baseFileName }}.js'),
    util    = require('../utils.js')(model),
    Seq     = orm.Sequelize();

module.exports = model;

// Some utility methods:
{% if table.relations|first %}util.getRelation({{ table.relations|first.as }}).onDelete = 'CASCADE'; {% endif %}
{% if table.columns|first %}util.getAttribute({{table.columns|first.accessorName}}).comment = 'This is the comment'; {% endif %}

------------------------------------------------------------------------------------*/
{%- endif %}

{% macro ifTrue(label, value) %}
    {% if value %}
        ,{{ label }}: {{ value }}
    {% endif %}
{% endmacro %}

{% macro ifFalse(label, value) %}
    {% if !value && value !== undefined %}
        ,{{ label }}: {{ value }}
    {% endif %}
{% endmacro %}

{% macro ifNotUndefined(label, value) %}
    {% if value !== undefined %}
        ,{{ label }}: {{ value }}
    {% endif %}
{% endmacro %}

{% include "./table.html" %}

{% endautoescape %}