diff --git a/src/entity.mst b/src/entity.mst index 882a464..83e4971 100644 --- a/src/entity.mst +++ b/src/entity.mst @@ -4,12 +4,11 @@ import {Index,Entity, PrimaryColumn, PrimaryGeneratedColumn, Column, OneToOne, O @Entity("{{EntityName}}"{{#Schema}},{schema:"{{.}}"}{{/Schema}}) -{{#Indexes}}{{^isPrimaryKey}}@Index("{{name}}",[{{#columns}}"{{name}}",{{/columns}}]{{#isUnique}},{unique:true}{{/isUnique}}) +{{#Indexes}}{{^isPrimaryKey}}@Index("{{name}}",[{{#columns}}"{{toPropertyName name}}",{{/columns}}]{{#isUnique}},{unique:true}{{/isUnique}}) {{/isPrimaryKey}}{{/Indexes}}export class {{toEntityName EntityName}} { {{#Columns}} - {{^relations}}{{#is_generated}} @PrimaryGeneratedColumn({ - {{/is_generated}}{{^is_generated}} @Column("{{sql_type}}",{ {{#is_nullable}} + {{^relations}}{{#is_generated}} @PrimaryGeneratedColumn({ {{/is_generated}}{{^is_generated}} @Column("{{sql_type}}",{ {{#is_nullable}} nullable:true,{{/is_nullable}}{{^is_nullable}} nullable:false,{{/is_nullable}}{{#isPrimary}} primary:{{isPrimary}},{{/isPrimary}}{{/is_generated}}{{#is_unique}}