index.html
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{% 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 %}