Added version column test

This commit is contained in:
Kononnable 2017-06-19 23:20:11 +02:00
parent 1d550f8589
commit d5be96adf4
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,18 @@
import { Column, Entity, Index, PrimaryGeneratedColumn, VersionColumn } from "typeorm"
@Entity("Post")
export class Post {
@PrimaryGeneratedColumn()
id: number;
@Column()
title: string;
@Column()
text: string;
@VersionColumn()
version: number;
}

View File

@ -148,6 +148,18 @@ export class EntityFileToJson {
retVal.columns.push(col);
continue;
}
} else if (trimmedLine.startsWith('@VersionColumn')) {
if (this.isPartOfMultilineStatement(trimmedLine)) {
isMultilineStatement = true;
priorPartOfMultilineStatement = trimmedLine;
continue;
} else {
isMultilineStatement = false;
let col = new EntityColumn()
this.getColumnOptionsAndType(trimmedLine, col)
retVal.columns.push(col);
continue;
}
} else if (trimmedLine.startsWith('@PrimaryGeneratedColumn')) {
if (this.isPartOfMultilineStatement(trimmedLine)) {
isMultilineStatement = true;
@ -246,10 +258,14 @@ export class EntityFileToJson {
}
})
continue
} else if (trimmedLine = '}') {
} else if (trimmedLine == '}') {
isInClassBody = false;
continue; //class declaration end
}
else {
console.log(`[EntityFileToJson:convert] Line not recognized in entity ${retVal.entityName}:`)
console.log(`${trimmedLine}`)
}
}
console.log(`[EntityFileToJson:convert] Line not recognized in entity ${retVal.entityName}:`)