Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
39e6c6e1c5
9 changed files with 617 additions and 0 deletions
|
|
@ -21,6 +21,9 @@ import { Province } from "./Province";
|
|||
import { SubDistrict } from "./SubDistrict";
|
||||
import { District } from "./District";
|
||||
import { ProfileAvatar } from "./ProfileAvatar";
|
||||
import { ProfileFamilyFather } from "./ProfileFamilyFather";
|
||||
import { ProfileFamilyMother } from "./ProfileFamilyMother";
|
||||
import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
|
||||
import { ProfileChildren } from "./ProfileChildren";
|
||||
import { ProfileDiscipline } from "./ProfileDiscipline";
|
||||
|
||||
|
|
@ -318,6 +321,15 @@ export class Profile extends EntityBase {
|
|||
@OneToMany(() => ProfileHistory, (v) => v.profile)
|
||||
histories: ProfileHistory[];
|
||||
|
||||
@OneToMany(() => ProfileFamilyFather, (v) => v.profile)
|
||||
profileFamilyFather: ProfileFamilyFather[];
|
||||
|
||||
@OneToMany(() => ProfileFamilyMother, (v) => v.profile)
|
||||
profileFamilyMother: ProfileFamilyMother[];
|
||||
|
||||
@OneToMany(() => ProfileFamilyCouple , (v) => v.profile)
|
||||
profileFamilyCouple: ProfileFamilyCouple[];
|
||||
|
||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles)
|
||||
@JoinColumn({ name: "posLevelId" })
|
||||
posLevel: PosLevel;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ import { ProfileAbility } from "./ProfileAbility";
|
|||
import { ProfileOther } from "./ProfileOther";
|
||||
import { ProfileAvatar } from "./ProfileAvatar";
|
||||
import { ProfileGovernment } from "./ProfileGovernment";
|
||||
import { ProfileFamilyFather } from "./ProfileFamilyFather";
|
||||
import { ProfileFamilyMother } from "./ProfileFamilyMother";
|
||||
import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
|
||||
|
||||
import { ProfileChildren } from "./ProfileChildren";
|
||||
@Entity("profileEmployee")
|
||||
export class ProfileEmployee extends EntityBase {
|
||||
|
|
@ -275,6 +279,15 @@ export class ProfileEmployee extends EntityBase {
|
|||
|
||||
@OneToMany(() => ProfileGovernment, (v) => v.profileEmployee)
|
||||
profileGovernment: ProfileGovernment[];
|
||||
|
||||
@OneToMany(() => ProfileFamilyFather, (v) => v.profile)
|
||||
profileFamilyFather: ProfileFamilyFather[];
|
||||
|
||||
@OneToMany(() => ProfileFamilyMother, (v) => v.profile)
|
||||
profileFamilyMother: ProfileFamilyMother[];
|
||||
|
||||
@OneToMany(() => ProfileFamilyCouple , (v) => v.profile)
|
||||
profileFamilyCouple: ProfileFamilyCouple[];
|
||||
}
|
||||
|
||||
@Entity("profileEmployeeHistory")
|
||||
|
|
|
|||
145
src/entities/ProfileFamilyCouple.ts
Normal file
145
src/entities/ProfileFamilyCouple.ts
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
import { ProfileFamilyCoupleHistory } from "./ProfileFamilyCoupleHistory";
|
||||
|
||||
@Entity("profileFamilyCouple")
|
||||
export class ProfileFamilyCouple extends EntityBase {
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
type: "boolean",
|
||||
})
|
||||
couple: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "คำนำหน้าคู่สมรส",
|
||||
})
|
||||
couplePrefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ชื่อคู่สมรส",
|
||||
})
|
||||
coupleFirstName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "นามสกุลคู่สมรส",
|
||||
})
|
||||
coupleLastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "นามสกุลคู่สมรส(เดิม)",
|
||||
})
|
||||
coupleLastNameOld: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "อาชีพคู่สมรส",
|
||||
})
|
||||
coupleCareer: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
length: 13,
|
||||
comment: "เลขที่บัตรประชาชนคู่สมรส",
|
||||
})
|
||||
coupleCitizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
type: "boolean",
|
||||
comment: "มีชีวิตคู่สมรส",
|
||||
})
|
||||
coupleLive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ความสัมพันธ์",
|
||||
length: 40,
|
||||
default: null,
|
||||
})
|
||||
relationship: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
type: "uuid",
|
||||
comment: "คีย์นอก(FK) ของตาราง Profile",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@OneToMany(
|
||||
() => ProfileFamilyCoupleHistory,
|
||||
(v) => v.histories,
|
||||
)
|
||||
profileFamilyCouple: ProfileFamilyCoupleHistory[];
|
||||
|
||||
@ManyToOne(() => Profile, (v) => v.profileFamilyCouple)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
|
||||
@ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyCouple)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
|
||||
}
|
||||
|
||||
export type CreateProfileFamilyCouple= {
|
||||
profileId: string;
|
||||
couple: boolean | null;
|
||||
couplePrefix: string | null;
|
||||
coupleFirstName: string | null;
|
||||
coupleLastName: string | null;
|
||||
coupleLastNameOld: string | null;
|
||||
coupleCareer: string | null;
|
||||
coupleCitizenId: string | null;
|
||||
coupleLive: boolean | null;
|
||||
relationship: string | null;
|
||||
}
|
||||
|
||||
export type CreateProfileEmployeeFamilyCouple= {
|
||||
profileEmployeeId: string;
|
||||
couple: boolean | null;
|
||||
couplePrefix: string | null;
|
||||
coupleFirstName: string | null;
|
||||
coupleLastName: string | null;
|
||||
coupleLastNameOld: string | null;
|
||||
coupleCareer: string | null;
|
||||
coupleCitizenId: string | null;
|
||||
coupleLive: boolean | null;
|
||||
relationship: string | null;
|
||||
}
|
||||
|
||||
export type UpdateProfileFamilyCouple = {
|
||||
couple?: boolean | null;
|
||||
couplePrefix?: string | null;
|
||||
coupleFirstName?: string | null;
|
||||
coupleLastName?: string | null;
|
||||
coupleLastNameOld?: string | null;
|
||||
coupleCareer?: string | null;
|
||||
coupleCitizenId?: string | null;
|
||||
coupleLive?: boolean | null;
|
||||
relationship: string | null;
|
||||
};
|
||||
60
src/entities/ProfileFamilyCoupleHistory.ts
Normal file
60
src/entities/ProfileFamilyCoupleHistory.ts
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
|
||||
|
||||
@Entity("profileFamilyCoupleHistory")
|
||||
export class ProfileFamilyCoupleHistory extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "คำนำหน้าบิดา",
|
||||
})
|
||||
fatherPrefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ชื่อบิดา",
|
||||
})
|
||||
fatherFirstName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "นามสกุลบิดา",
|
||||
})
|
||||
fatherLastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "อาชีพบิดา",
|
||||
})
|
||||
fatherCareer: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "เลขที่บัตรประชาชนบิดา",
|
||||
})
|
||||
fatherCitizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "มีชีวิตบิดา",
|
||||
})
|
||||
fatherLive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileFamilyFather",
|
||||
default: null,
|
||||
})
|
||||
profileFamilyCoupleId: string;
|
||||
|
||||
@ManyToOne(() => ProfileFamilyCouple, (v) => v.profileFamilyCouple)
|
||||
@JoinColumn({ name: "profileFamilyCoupleId" })
|
||||
histories: ProfileFamilyCouple;
|
||||
}
|
||||
112
src/entities/ProfileFamilyFather.ts
Normal file
112
src/entities/ProfileFamilyFather.ts
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
import { ProfileFamilyFatherHistory } from "./ProfileFamilyFatherHistory";
|
||||
|
||||
@Entity("profileFamilyFather")
|
||||
export class ProfileFamilyFather extends EntityBase {
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "คำนำหน้าบิดา",
|
||||
})
|
||||
fatherPrefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ชื่อบิดา",
|
||||
})
|
||||
fatherFirstName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "นามสกุลบิดา",
|
||||
})
|
||||
fatherLastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "อาชีพบิดา",
|
||||
})
|
||||
fatherCareer: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "เลขที่บัตรประชาชนบิดา",
|
||||
})
|
||||
fatherCitizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "มีชีวิตบิดา",
|
||||
})
|
||||
fatherLive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
type: "uuid",
|
||||
comment: "คีย์นอก(FK) ของตาราง Profile",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@OneToMany(
|
||||
() => ProfileFamilyFatherHistory,
|
||||
(v) => v.histories,
|
||||
)
|
||||
profileFamilyFather: ProfileFamilyFatherHistory[];
|
||||
|
||||
@ManyToOne(() => Profile, (v) => v.profileFamilyFather)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
|
||||
@ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyFather)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
|
||||
}
|
||||
|
||||
export type CreateProfileFamilyFather = {
|
||||
profileId: string;
|
||||
fatherPrefix: string | null;
|
||||
fatherFirstName: string | null;
|
||||
fatherLastName: string | null;
|
||||
fatherCareer: string | null;
|
||||
fatherCitizenId: string | null;
|
||||
fatherLive: boolean | null;
|
||||
}
|
||||
|
||||
export type CreateProfileEmployeeFamilyFather = {
|
||||
profileEmployeeId: string;
|
||||
fatherPrefix: string | null;
|
||||
fatherFirstName: string | null;
|
||||
fatherLastName: string | null;
|
||||
fatherCareer: string | null;
|
||||
fatherCitizenId: string | null;
|
||||
fatherLive: boolean | null;
|
||||
}
|
||||
|
||||
export type UpdateProfileFamilyFather = {
|
||||
fatherPrefix?: string | null;
|
||||
fatherFirstName?: string | null;
|
||||
fatherLastName?: string | null;
|
||||
fatherCareer?: string | null;
|
||||
fatherCitizenId?: string | null;
|
||||
fatherLive?: boolean | null;
|
||||
};
|
||||
60
src/entities/ProfileFamilyFatherHistory.ts
Normal file
60
src/entities/ProfileFamilyFatherHistory.ts
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ProfileFamilyFather } from "./ProfileFamilyFather";
|
||||
|
||||
@Entity("profileFamilyFatherHistory")
|
||||
export class ProfileFamilyFatherHistory extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "คำนำหน้าบิดา",
|
||||
})
|
||||
fatherPrefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ชื่อบิดา",
|
||||
})
|
||||
fatherFirstName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "นามสกุลบิดา",
|
||||
})
|
||||
fatherLastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "อาชีพบิดา",
|
||||
})
|
||||
fatherCareer: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "เลขที่บัตรประชาชนบิดา",
|
||||
})
|
||||
fatherCitizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "มีชีวิตบิดา",
|
||||
})
|
||||
fatherLive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileFamilyFather",
|
||||
default: null,
|
||||
})
|
||||
profileFamilyFatherId: string;
|
||||
|
||||
@ManyToOne(() => ProfileFamilyFather, (v) => v.profileFamilyFather)
|
||||
@JoinColumn({ name: "profileFamilyFatherId" })
|
||||
histories: ProfileFamilyFather;
|
||||
}
|
||||
112
src/entities/ProfileFamilyMother.ts
Normal file
112
src/entities/ProfileFamilyMother.ts
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
import { ProfileFamilyMotherHistory } from "./ProfileFamilyMotherHistory";
|
||||
|
||||
@Entity("profileFamilyMother")
|
||||
export class ProfileFamilyMother extends EntityBase {
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "คำนำหน้ามารดา",
|
||||
})
|
||||
motherPrefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ชื่อมารดา",
|
||||
})
|
||||
motherFirstName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "นามสกุลมารดา",
|
||||
})
|
||||
motherLastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "อาชีพบิดา",
|
||||
})
|
||||
motherCareer: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "เลขที่บัตรประชาชนมารดา",
|
||||
})
|
||||
motherCitizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "มีชีวิตมารดา",
|
||||
})
|
||||
motherLive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
type: "uuid",
|
||||
comment: "คีย์นอก(FK) ของตาราง Profile",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@OneToMany(
|
||||
() => ProfileFamilyMotherHistory,
|
||||
(v) => v.histories,
|
||||
)
|
||||
profileFamilyMother: ProfileFamilyMotherHistory[];
|
||||
|
||||
@ManyToOne(() => Profile, (v) => v.profileFamilyMother)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
|
||||
@ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyMother)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
|
||||
}
|
||||
|
||||
export type CreateProfileFamilyMother = {
|
||||
profileId: string;
|
||||
motherPrefix: string | null;
|
||||
motherFirstName: string | null;
|
||||
motherLastName: string | null;
|
||||
motherCareer: string | null;
|
||||
motherCitizenId: string | null;
|
||||
motherLive: boolean | null;
|
||||
}
|
||||
|
||||
export type CreateProfileEmployeeFamilyMother= {
|
||||
profileEmployeeId: string;
|
||||
motherPrefix: string | null;
|
||||
motherFirstName: string | null;
|
||||
motherLastName: string | null;
|
||||
motherCareer: string | null;
|
||||
motherCitizenId: string | null;
|
||||
motherLive: boolean | null;
|
||||
}
|
||||
|
||||
export type UpdateProfileFamilyMother= {
|
||||
motherPrefix: string | null;
|
||||
motherFirstName: string | null;
|
||||
motherLastName: string | null;
|
||||
motherCareer: string | null;
|
||||
motherCitizenId: string | null;
|
||||
motherLive: boolean | null;
|
||||
};
|
||||
61
src/entities/ProfileFamilyMotherHistory.ts
Normal file
61
src/entities/ProfileFamilyMotherHistory.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ProfileFamilyMother } from "./ProfileFamilyMother";
|
||||
|
||||
@Entity("profileFamilyMotherHistory")
|
||||
export class ProfileFamilyMotherHistory extends EntityBase {
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "คำนำหน้ามารดา",
|
||||
})
|
||||
motherPrefix: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ชื่อมารดา",
|
||||
})
|
||||
motherFirstName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "นามสกุลมารดา",
|
||||
})
|
||||
motherLastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "อาชีพบิดา",
|
||||
})
|
||||
motherCareer: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "เลขที่บัตรประชาชนมารดา",
|
||||
})
|
||||
motherCitizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "มีชีวิตมารดา",
|
||||
})
|
||||
motherLive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileFamilyMother",
|
||||
default: null,
|
||||
})
|
||||
profileFamilyMotherId: string;
|
||||
|
||||
@ManyToOne(() => ProfileFamilyMother, (v) => v.profileFamilyMother)
|
||||
@JoinColumn({ name: "profileFamilyMotherId" })
|
||||
histories: ProfileFamilyMother;
|
||||
}
|
||||
42
src/migration/1715683524015-add_table_Profilefather.ts
Normal file
42
src/migration/1715683524015-add_table_Profilefather.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddTableProfilefather1715683524015 implements MigrationInterface {
|
||||
name = 'AddTableProfilefather1715683524015'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE TABLE \`profileFamilyFatherHistory\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`fatherPrefix\` varchar(255) NULL COMMENT 'คำนำหน้าบิดา', \`fatherFirstName\` varchar(255) NULL COMMENT 'ชื่อบิดา', \`fatherLastName\` varchar(255) NULL COMMENT 'นามสกุลบิดา', \`fatherCareer\` varchar(255) NULL COMMENT 'อาชีพบิดา', \`fatherCitizenId\` varchar(255) NULL COMMENT 'เลขที่บัตรประชาชนบิดา', \`fatherLive\` tinyint NULL COMMENT 'มีชีวิตบิดา', \`profileFamilyFatherId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileFamilyFather', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`profileFamilyFather\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`fatherPrefix\` varchar(255) NULL COMMENT 'คำนำหน้าบิดา', \`fatherFirstName\` varchar(255) NULL COMMENT 'ชื่อบิดา', \`fatherLastName\` varchar(255) NULL COMMENT 'นามสกุลบิดา', \`fatherCareer\` varchar(255) NULL COMMENT 'อาชีพบิดา', \`fatherCitizenId\` varchar(255) NULL COMMENT 'เลขที่บัตรประชาชนบิดา', \`fatherLive\` tinyint NULL COMMENT 'มีชีวิตบิดา', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK) ของตาราง Profile', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`profileFamilyMotherHistory\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`motherPrefix\` varchar(255) NULL COMMENT 'คำนำหน้ามารดา', \`motherFirstName\` varchar(255) NULL COMMENT 'ชื่อมารดา', \`motherLastName\` varchar(255) NULL COMMENT 'นามสกุลมารดา', \`motherCareer\` varchar(255) NULL COMMENT 'อาชีพบิดา', \`motherCitizenId\` varchar(255) NULL COMMENT 'เลขที่บัตรประชาชนมารดา', \`motherLive\` tinyint NULL COMMENT 'มีชีวิตมารดา', \`profileFamilyMotherId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileFamilyMother', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`profileFamilyMother\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`motherPrefix\` varchar(255) NULL COMMENT 'คำนำหน้ามารดา', \`motherFirstName\` varchar(255) NULL COMMENT 'ชื่อมารดา', \`motherLastName\` varchar(255) NULL COMMENT 'นามสกุลมารดา', \`motherCareer\` varchar(255) NULL COMMENT 'อาชีพบิดา', \`motherCitizenId\` varchar(255) NULL COMMENT 'เลขที่บัตรประชาชนมารดา', \`motherLive\` tinyint NULL COMMENT 'มีชีวิตมารดา', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK) ของตาราง Profile', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`profileFamilyCoupleHistory\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`fatherPrefix\` varchar(255) NULL COMMENT 'คำนำหน้าบิดา', \`fatherFirstName\` varchar(255) NULL COMMENT 'ชื่อบิดา', \`fatherLastName\` varchar(255) NULL COMMENT 'นามสกุลบิดา', \`fatherCareer\` varchar(255) NULL COMMENT 'อาชีพบิดา', \`fatherCitizenId\` varchar(255) NULL COMMENT 'เลขที่บัตรประชาชนบิดา', \`fatherLive\` tinyint NULL COMMENT 'มีชีวิตบิดา', \`profileFamilyCoupleId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileFamilyFather', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`profileFamilyCouple\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`couple\` tinyint NULL, \`couplePrefix\` varchar(255) NULL COMMENT 'คำนำหน้าคู่สมรส', \`coupleFirstName\` varchar(255) NULL COMMENT 'ชื่อคู่สมรส', \`coupleLastName\` varchar(255) NULL COMMENT 'นามสกุลคู่สมรส', \`coupleLastNameOld\` varchar(255) NULL COMMENT 'นามสกุลคู่สมรส(เดิม)', \`coupleCareer\` varchar(255) NULL COMMENT 'อาชีพคู่สมรส', \`coupleCitizenId\` varchar(13) NULL COMMENT 'เลขที่บัตรประชาชนคู่สมรส', \`coupleLive\` tinyint NULL COMMENT 'มีชีวิตคู่สมรส', \`relationship\` varchar(40) NULL COMMENT 'ความสัมพันธ์', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK) ของตาราง Profile', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyFatherHistory\` ADD CONSTRAINT \`FK_6629eded70dc92ea1aeb3e85b9c\` FOREIGN KEY (\`profileFamilyFatherId\`) REFERENCES \`profileFamilyFather\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyFather\` ADD CONSTRAINT \`FK_4e6e4398088759257f0d647481b\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyFather\` ADD CONSTRAINT \`FK_30aed478da56fc7f14b2716c397\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyMotherHistory\` ADD CONSTRAINT \`FK_1af4d1673e616bd1af623f32402\` FOREIGN KEY (\`profileFamilyMotherId\`) REFERENCES \`profileFamilyMother\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyMother\` ADD CONSTRAINT \`FK_39b3c862fc9822b94a4fe2027b0\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyMother\` ADD CONSTRAINT \`FK_b7ecea341cf3c2aa82f78b768ef\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyCoupleHistory\` ADD CONSTRAINT \`FK_849255f4788774b559b7dca8eda\` FOREIGN KEY (\`profileFamilyCoupleId\`) REFERENCES \`profileFamilyCouple\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyCouple\` ADD CONSTRAINT \`FK_6c6624f4d3f33de4942dd5b6fc5\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyCouple\` ADD CONSTRAINT \`FK_68a54ba0970de34319338943581\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyCouple\` DROP FOREIGN KEY \`FK_68a54ba0970de34319338943581\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyCouple\` DROP FOREIGN KEY \`FK_6c6624f4d3f33de4942dd5b6fc5\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyCoupleHistory\` DROP FOREIGN KEY \`FK_849255f4788774b559b7dca8eda\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyMother\` DROP FOREIGN KEY \`FK_b7ecea341cf3c2aa82f78b768ef\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyMother\` DROP FOREIGN KEY \`FK_39b3c862fc9822b94a4fe2027b0\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyMotherHistory\` DROP FOREIGN KEY \`FK_1af4d1673e616bd1af623f32402\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyFather\` DROP FOREIGN KEY \`FK_30aed478da56fc7f14b2716c397\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyFather\` DROP FOREIGN KEY \`FK_4e6e4398088759257f0d647481b\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileFamilyFatherHistory\` DROP FOREIGN KEY \`FK_6629eded70dc92ea1aeb3e85b9c\``);
|
||||
await queryRunner.query(`DROP TABLE \`profileFamilyCouple\``);
|
||||
await queryRunner.query(`DROP TABLE \`profileFamilyCoupleHistory\``);
|
||||
await queryRunner.query(`DROP TABLE \`profileFamilyMother\``);
|
||||
await queryRunner.query(`DROP TABLE \`profileFamilyMotherHistory\``);
|
||||
await queryRunner.query(`DROP TABLE \`profileFamilyFather\``);
|
||||
await queryRunner.query(`DROP TABLE \`profileFamilyFatherHistory\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue