fix test utility

This commit is contained in:
Kononnable 2019-10-07 23:06:55 +02:00
parent 681ef1a363
commit 886147e4c0
12 changed files with 38 additions and 47 deletions

View File

@ -22,15 +22,15 @@ import { PostCategory } from "./PostCategory";
export class Post {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@ManyToOne(type => PostAuthor, PostAuthor => PostAuthor.Id)
@ManyToOne(type => PostAuthor, PostAuthor => PostAuthor.id)
@JoinColumn()
postAuthor: PostAuthor;
@ManyToOne(type => PostCategory, PostCategory => PostCategory.Id)
@ManyToOne(type => PostCategory, PostCategory => PostCategory.id)
@JoinColumn()
postCategory: PostCategory;
}

View File

@ -17,10 +17,10 @@ import { Post } from "./Post";
export class PostAuthor {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToMany(type => Post, Post => Post.Id)
@OneToMany(type => Post, Post => Post.id)
posts: Post[];
}

View File

@ -17,10 +17,10 @@ import { Post } from "./Post";
export class PostCategory {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToMany(type => Post, Post => Post.Id)
@OneToMany(type => Post, Post => Post.id)
posts: Post[];
}

View File

@ -17,13 +17,13 @@ import { PostReader } from "./PostReader";
export class Post {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToOne(type => PostAuthor, PostAuthor => PostAuthor.Id)
@OneToOne(type => PostAuthor, PostAuthor => PostAuthor.id)
postAuthor: PostAuthor;
@OneToMany(type => PostReader, PostReader => PostReader.Id)
@OneToMany(type => PostReader, PostReader => PostReader.id)
postReaders: PostReader[];
}

View File

@ -17,11 +17,11 @@ import { Post } from "./Post";
export class PostAuthor {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToOne(type => Post, Post => Post.Id)
@OneToOne(type => Post, Post => Post.id)
@JoinColumn()
post: Post;

View File

@ -17,11 +17,11 @@ import { Post } from "./Post";
export class PostReader {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@ManyToOne(type => Post, Post => Post.Id)
@ManyToOne(type => Post, Post => Post.id)
@JoinColumn()
post: Post;

View File

@ -20,26 +20,26 @@ export class Post {
@Column("int", {
// nullable: false,
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToOne(type => PostAuthor, PostAuthor => PostAuthor.Id, {
@OneToOne(type => PostAuthor, PostAuthor => PostAuthor.id, {
// onDelete: "CASCADE",
// onUpdate: "CASCADE"
})
postAuthor: PostAuthor;
@OneToOne(type => PostReader, PostReader => PostReader.Id)
@OneToOne(type => PostReader, PostReader => PostReader.id)
postReader: PostReader;
@OneToOne(type => PostCategory, PostCategory => PostCategory.Id, {
@OneToOne(type => PostCategory, PostCategory => PostCategory.id, {
// onDelete: "RESTRICT",
// onUpdate: "RESTRICT"
})
postCategory: PostCategory;
@OneToOne(type => PostDetails, PostDetails => PostDetails.Id, {
@OneToOne(type => PostDetails, PostDetails => PostDetails.id, {
// onDelete: "SET NULL",
// onUpdate: "SET NULL"
})

View File

@ -17,11 +17,11 @@ import { Post } from "./Post";
export class PostAuthor {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToOne(type => Post, Post => Post.Id, {
@OneToOne(type => Post, Post => Post.id, {
onDelete: "CASCADE"
// onUpdate: "CASCADE"
})

View File

@ -17,11 +17,11 @@ import { Post } from "./Post";
export class PostCategory {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToOne(type => Post, Post => Post.Id, {
@OneToOne(type => Post, Post => Post.id, {
// onDelete: "RESTRICT",
// onUpdate: "RESTRICT"
})

View File

@ -17,11 +17,11 @@ import { Post } from "./Post";
export class PostDetails {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToOne(type => Post, Post => Post.Id, {
@OneToOne(type => Post, Post => Post.id, {
onDelete: "SET NULL"
// onUpdate: "SET NULL"
})

View File

@ -17,11 +17,11 @@ import { Post } from "./Post";
export class PostReader {
@Column("int", {
primary: true,
name: "Id"
name: "id"
})
Id: number;
id: number;
@OneToOne(type => Post, Post => Post.Id)
@OneToOne(type => Post, Post => Post.id)
@JoinColumn()
post: Post;
}

View File

@ -499,15 +499,6 @@ export default class EntityFileToJson {
console.log(`${trimmedLine}`);
});
retVal.columns = retVal.columns.map(col => {
if (col.columnName.endsWith("Id")) {
col.columnName = col.columnName.substr(
0,
col.columnName.length - 2
);
}
return col;
});
retVal.indicies = retVal.indicies.map(ind => {
ind.columnNames = ind.columnNames.map(colName => {
if (colName.endsWith("Id")) {