diff --git a/test/integration/examples/sample17-versioning/entity/Post.ts b/test/integration/examples/sample17-versioning/entity/Post.ts new file mode 100644 index 0000000..60b8d24 --- /dev/null +++ b/test/integration/examples/sample17-versioning/entity/Post.ts @@ -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; + +} \ No newline at end of file diff --git a/test/utils/EntityFileToJson.ts b/test/utils/EntityFileToJson.ts index 07b4254..2ae6f19 100644 --- a/test/utils/EntityFileToJson.ts +++ b/test/utils/EntityFileToJson.ts @@ -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}:`)