chore: migration

This commit is contained in:
Methapon Metanipat 2024-09-25 16:42:02 +07:00
parent e4064a0695
commit 78e248c305
2 changed files with 34 additions and 5 deletions

View file

@ -0,0 +1,29 @@
-- DropForeignKey
ALTER TABLE "CustomerBranchCitizen" DROP CONSTRAINT "CustomerBranchCitizen_customerBranchId_fkey";
-- DropForeignKey
ALTER TABLE "CustomerBranchCommercialRegis" DROP CONSTRAINT "CustomerBranchCommercialRegis_customerBranchId_fkey";
-- DropForeignKey
ALTER TABLE "CustomerBranchHouseRegis" DROP CONSTRAINT "CustomerBranchHouseRegis_customerBranchId_fkey";
-- DropForeignKey
ALTER TABLE "CustomerBranchPoa" DROP CONSTRAINT "CustomerBranchPoa_customerBranchId_fkey";
-- DropForeignKey
ALTER TABLE "CustomerBranchVatRegis" DROP CONSTRAINT "CustomerBranchVatRegis_customerBranchId_fkey";
-- AddForeignKey
ALTER TABLE "CustomerBranchCitizen" ADD CONSTRAINT "CustomerBranchCitizen_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomerBranchPoa" ADD CONSTRAINT "CustomerBranchPoa_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomerBranchHouseRegis" ADD CONSTRAINT "CustomerBranchHouseRegis_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomerBranchCommercialRegis" ADD CONSTRAINT "CustomerBranchCommercialRegis_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomerBranchVatRegis" ADD CONSTRAINT "CustomerBranchVatRegis_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -572,7 +572,7 @@ model CustomerBranchCitizen {
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
}
model CustomerBranchPoa {
@ -581,7 +581,7 @@ model CustomerBranchPoa {
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
}
model CustomerBranchHouseRegis {
@ -634,7 +634,7 @@ model CustomerBranchHouseRegis {
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
}
enum CommercialType {
@ -656,7 +656,7 @@ model CustomerBranchCommercialRegis {
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
}
model CustomerBranchVatRegis {
@ -665,7 +665,7 @@ model CustomerBranchVatRegis {
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id], onDelete: Cascade)
}
model Employee {