{# Templates are sensitive to new lines. Be cautious to use <%- and -%> delete new lines operator operators. #} {# To make macros inline start with {% -%} and end with {%- -%} #} {% macro modelName(table) -%} {{ table.schema.name | camelCase}}_{{ table.name | camelCase }} {%- endmacro -%} {% macro attributeName(column) -%} {{ column.name }} {%- endmacro -%} {% macro hasManyAlias(relation) -%} {{ relation.constraint.name | stripPrefix(relation.sourceTable) | camelCase }} {%- endmacro -%} {% macro hasOneAlias(relation) -%} {{ relation.constraint.name | stripPrefix(relation.sourceTable) | camelCase }} {%- endmacro -%} {% macro belongsToAlias(relation) -%} {{ relation.constraint.columns.array[0].name | relationName | camelCase }} {%- endmacro -%} {% macro belongsToManyAlias(relation) -%} {{ relation.joinTable.name | camelCase }}{{ relation.targetConstraint.columns.array[0].name | relationName('') | camelCase }} {%- endmacro -%}