{% from '../partials/helper.nunj.html' import modelName, attributeName, hasManyAlias, belongsToAlias, belongsToManyAlias -%} {% for schema in db.schemas.array -%} {% for table in schema.tables.array %} {% set c = custom[modelName(table)] -%} {# Custom Data for this table i.e. "custom.Account" #} {% set nameLen = modelName(table) | length -%} {{ modelName(table) }} {{ '-' | padRight(nameLen, '-') }} {% for relation in table.o2mRelations.array -%} {% set cr = c.hasMany[hasManyAlias(relation)] -%} {{ 'has many' | padRight(17) }} {{ relation.targetTable.name | padRight(40) }} as {{ cr.as or hasManyAlias(relation).val }} {% if cr.as %}( instead of {{ hasManyAlias(relation).val }} ){% endif %} {% endfor -%} {% for relation in table.m2oRelations.array -%} {% set cr = c.belongsTo[belongsToAlias(relation)] -%} {{ 'belongs to' | padRight(17) }} {{ relation.targetTable.name | padRight(40) }} as {{ cr.as or belongsToAlias(relation).val }} {% if cr.as %}( instead of {{ belongsToAlias(relation).val }} ){% endif %} {% endfor -%} {% for relation in table.m2mRelations.array -%} {% set cr = c.belongsToMany[belongsToManyAlias(relation)] -%} {{ 'belongs to many' | padRight(17) }} {{ relation.targetTable.name | padRight(40) }} as {{ cr.as or belongsToManyAlias(relation).val }} {% if cr.as %}( instead of {{ belongsToManyAlias(relation).val }} ){% endif %} {% endfor -%} {% endfor -%} {% endfor -%}