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