fix test utility
This commit is contained in:
parent
681ef1a363
commit
886147e4c0
@ -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;
|
||||
}
|
||||
|
@ -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[];
|
||||
}
|
||||
|
@ -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[];
|
||||
}
|
||||
|
@ -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[];
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
})
|
||||
|
@ -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"
|
||||
})
|
||||
|
@ -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"
|
||||
})
|
||||
|
@ -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"
|
||||
})
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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")) {
|
||||
|
Loading…
Reference in New Issue
Block a user