const {Model, DataTypes, Op} = require("sequelize");

class {{ table.TABLE_NAME | toUpperCamel }} extends Model \{

\}

{{ table.TABLE_NAME | toUpperCamel }}.init(\{
{% for column in table.columns2 %}    {{ column.COLUMN_NAME }}: \{
        type: DataTypes.{{ column.COLUMN_TYPE | safe }},
        {% if column.COLUMN_KEY == 'PRI' -%}
        primaryKey: true,
        {% elif column.IS_NULLABLE == 'NO' %}
        allowNull: false,
        {% endif -%}
        {% if column.EXTRA == 'auto_increment' -%}
        autoIncrement: true,
        {% endif -%}
        comment: `{{ column.COLUMN_COMMENT }}`,
    \},
{% endfor %}\}, \{
    sequelize: global.db,
    tableName: "{{ table.TABLE_NAME | toUnderScore }}"
\});

module.exports = \{{{ table.TABLE_NAME | toUpperCamel }}\};