diff --git a/src/entities/ProfileInformation.ts b/src/entities/ProfileInformation.ts index 6ee1490a..e6157a5e 100644 --- a/src/entities/ProfileInformation.ts +++ b/src/entities/ProfileInformation.ts @@ -2,11 +2,11 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; -import { ProfileInformationHistory } from "./ProfileInformationHistory"; import { BloodGroup } from "./BloodGroup"; import { Relationship } from "./Relationship"; import { Gender } from "./Gender"; -@Entity("profileinformation") + +@Entity("profileInformation") export class ProfileInformation extends EntityBase { @Column({ nullable: true, @@ -152,3 +152,18 @@ export type UpdateProfileInformation = { relationshipId?: string | null; bloodGroupId?: string | null; }; + +@Entity("profileInformationHistory") +export class ProfileInformationHistory extends ProfileInformation { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileInformation", + default: null, + }) + profileInformationId: string; + + @ManyToOne(() => ProfileInformation, (v) => v.profileInformationHistory, { onDelete: "CASCADE" }) + @JoinColumn({ name: "profileInformationId" }) + profileInformation: ProfileInformation; +} diff --git a/src/entities/ProfileInformationHistory.ts b/src/entities/ProfileInformationHistory.ts deleted file mode 100644 index c7c04b27..00000000 --- a/src/entities/ProfileInformationHistory.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; - -import { ProfileInformation } from "./ProfileInformation"; - -@Entity("profileinformationHistory") -export class ProfileInformationHistory extends ProfileInformation { - @Column({ - nullable: true, - length: 40, - comment: "คีย์นอก(FK)ของตาราง ProfileInformation", - default: null, - }) - profileInformationId: string; - - @ManyToOne(() => ProfileInformation, (v) => v.profileInformationHistory, { onDelete: "CASCADE" }) - @JoinColumn({ name: "profileInformationId" }) - profileInformation: ProfileInformation; -}