refactor: change datetime field to date only

This commit is contained in:
Methapon Metanipat 2024-08-21 13:05:02 +07:00
parent 06ac50f2d0
commit 6ad05b4292
2 changed files with 59 additions and 22 deletions

View file

@ -0,0 +1,37 @@
-- AlterTable
ALTER TABLE "Customer" ALTER COLUMN "birthDate" SET DATA TYPE DATE;
-- AlterTable
ALTER TABLE "CustomerBranch" ALTER COLUMN "registerDate" SET DATA TYPE DATE,
ALTER COLUMN "payDate" SET DATA TYPE DATE;
-- AlterTable
ALTER TABLE "Employee" ALTER COLUMN "dateOfBirth" SET DATA TYPE DATE,
ALTER COLUMN "passportIssueDate" SET DATA TYPE DATE,
ALTER COLUMN "passportExpiryDate" SET DATA TYPE DATE,
ALTER COLUMN "visaIssueDate" SET DATA TYPE DATE,
ALTER COLUMN "visaExpiryDate" SET DATA TYPE DATE,
ALTER COLUMN "visaStayUntilDate" SET DATA TYPE DATE,
ALTER COLUMN "entryDate" SET DATA TYPE DATE;
-- AlterTable
ALTER TABLE "EmployeeCheckup" ALTER COLUMN "coverageStartDate" SET DATA TYPE DATE,
ALTER COLUMN "coverageExpireDate" SET DATA TYPE DATE;
-- AlterTable
ALTER TABLE "EmployeeWork" ALTER COLUMN "workPermitIssuDate" SET DATA TYPE DATE,
ALTER COLUMN "workPermitExpireDate" SET DATA TYPE DATE,
ALTER COLUMN "workEndDate" SET DATA TYPE DATE;
-- AlterTable
ALTER TABLE "Quotation" ALTER COLUMN "payBillDate" SET DATA TYPE DATE;
-- AlterTable
ALTER TABLE "QuotationPaySplit" ALTER COLUMN "date" SET DATA TYPE DATE;
-- AlterTable
ALTER TABLE "User" ALTER COLUMN "startDate" SET DATA TYPE DATE,
ALTER COLUMN "retireDate" SET DATA TYPE DATE,
ALTER COLUMN "licenseIssueDate" SET DATA TYPE DATE,
ALTER COLUMN "licenseExpireDate" SET DATA TYPE DATE,
ALTER COLUMN "birthDate" SET DATA TYPE DATE;

View file

@ -323,8 +323,8 @@ model User {
registrationNo String? registrationNo String?
startDate DateTime? startDate DateTime? @db.Date
retireDate DateTime? retireDate DateTime? @db.Date
checkpoint String? checkpoint String?
checkpointEN String? checkpointEN String?
@ -335,8 +335,8 @@ model User {
discountCondition String? discountCondition String?
licenseNo String? licenseNo String?
licenseIssueDate DateTime? licenseIssueDate DateTime? @db.Date
licenseExpireDate DateTime? licenseExpireDate DateTime? @db.Date
sourceNationality String? sourceNationality String?
importNationality String? importNationality String?
@ -344,7 +344,7 @@ model User {
trainingPlace String? trainingPlace String?
responsibleArea String? responsibleArea String?
birthDate DateTime? birthDate DateTime? @db.Date
status Status @default(CREATED) status Status @default(CREATED)
statusOrder Int @default(0) statusOrder Int @default(0)
@ -413,7 +413,7 @@ model Customer {
lastName String lastName String
lastNameEN String? lastNameEN String?
gender String gender String
birthDate DateTime birthDate DateTime @db.Date
status Status @default(CREATED) status Status @default(CREATED)
statusOrder Int @default(0) statusOrder Int @default(0)
@ -445,7 +445,7 @@ model CustomerBranch {
legalPersonNo String? legalPersonNo String?
registerName String? registerName String?
registerNameEN String? registerNameEN String?
registerDate DateTime? registerDate DateTime? @db.Date
authorizedCapital String? authorizedCapital String?
workplace String workplace String
@ -472,7 +472,7 @@ model CustomerBranch {
jobPositionEN String jobPositionEN String
jobDescription String jobDescription String
saleEmployee String saleEmployee String
payDate DateTime payDate DateTime @db.Date
wageRate Int wageRate Int
status Status @default(CREATED) status Status @default(CREATED)
@ -499,7 +499,7 @@ model Employee {
lastName String lastName String
lastNameEN String lastNameEN String
dateOfBirth DateTime dateOfBirth DateTime @db.Date
gender String gender String
nationality String nationality String
@ -519,20 +519,20 @@ model Employee {
passportType String passportType String
passportNumber String passportNumber String
passportIssueDate DateTime passportIssueDate DateTime @db.Date
passportExpiryDate DateTime passportExpiryDate DateTime @db.Date
passportIssuingCountry String passportIssuingCountry String
passportIssuingPlace String passportIssuingPlace String
previousPassportReference String? previousPassportReference String?
visaType String? visaType String?
visaNumber String? visaNumber String?
visaIssueDate DateTime? visaIssueDate DateTime? @db.Date
visaExpiryDate DateTime? visaExpiryDate DateTime? @db.Date
visaIssuingPlace String? visaIssuingPlace String?
visaStayUntilDate DateTime? visaStayUntilDate DateTime? @db.Date
tm6Number String? tm6Number String?
entryDate DateTime? entryDate DateTime? @db.Date
workerStatus String? workerStatus String?
customerBranch CustomerBranch? @relation(fields: [customerBranchId], references: [id], onDelete: SetNull) customerBranch CustomerBranch? @relation(fields: [customerBranchId], references: [id], onDelete: SetNull)
@ -586,8 +586,8 @@ model EmployeeCheckup {
remark String? remark String?
medicalBenefitScheme String? medicalBenefitScheme String?
insuranceCompany String? insuranceCompany String?
coverageStartDate DateTime? coverageStartDate DateTime? @db.Date
coverageExpireDate DateTime? coverageExpireDate DateTime? @db.Date
createdAt DateTime @default(now()) createdAt DateTime @default(now())
createdBy User? @relation(name: "EmployeeCheckupCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull) createdBy User? @relation(name: "EmployeeCheckupCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
@ -608,9 +608,9 @@ model EmployeeWork {
jobType String? jobType String?
workplace String? workplace String?
workPermitNo String? workPermitNo String?
workPermitIssuDate DateTime? workPermitIssuDate DateTime? @db.Date
workPermitExpireDate DateTime? workPermitExpireDate DateTime? @db.Date
workEndDate DateTime? workEndDate DateTime? @db.Date
remark String? remark String?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
@ -821,7 +821,7 @@ model Quotation {
paySplitCount Int? paySplitCount Int?
paySplit QuotationPaySplit[] paySplit QuotationPaySplit[]
payBillDate DateTime? payBillDate DateTime? @db.Date
workerCount Int workerCount Int
worker QuotationWorker[] worker QuotationWorker[]
@ -848,7 +848,7 @@ model QuotationPaySplit {
id String @id @default(uuid()) id String @id @default(uuid())
no Int no Int
date DateTime date DateTime @db.Date
quotation Quotation? @relation(fields: [quotationId], references: [id]) quotation Quotation? @relation(fields: [quotationId], references: [id])
quotationId String? quotationId String?