fix(prisma): small pay-period fix

This commit is contained in:
Matthieu Haineault 2025-07-30 13:15:46 -04:00
parent ec98adbcc3
commit f85a213561
2 changed files with 92 additions and 38 deletions

View File

@ -0,0 +1,54 @@
/*
Warnings:
- You are about to drop the column `expense_code_id` on the `expenses` table. All the data in the column will be lost.
- You are about to drop the column `shift_code_id` on the `shifts` table. All the data in the column will be lost.
- You are about to drop the `expense_codes` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `shift_codes` table. If the table is not empty, all the data it contains will be lost.
- Added the required column `bank_code_id` to the `expenses` table without a default value. This is not possible if the table is not empty.
- Added the required column `bank_code_id` to the `leave_requests` table without a default value. This is not possible if the table is not empty.
- Added the required column `bank_code_id` to the `shifts` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "expenses" DROP CONSTRAINT "expenses_expense_code_id_fkey";
-- DropForeignKey
ALTER TABLE "shifts" DROP CONSTRAINT "shifts_shift_code_id_fkey";
-- AlterTable
ALTER TABLE "expenses" DROP COLUMN "expense_code_id",
ADD COLUMN "bank_code_id" INTEGER NOT NULL;
-- AlterTable
ALTER TABLE "leave_requests" ADD COLUMN "bank_code_id" INTEGER NOT NULL;
-- AlterTable
ALTER TABLE "shifts" DROP COLUMN "shift_code_id",
ADD COLUMN "bank_code_id" INTEGER NOT NULL;
-- DropTable
DROP TABLE "expense_codes";
-- DropTable
DROP TABLE "shift_codes";
-- CreateTable
CREATE TABLE "bank_codes" (
"id" SERIAL NOT NULL,
"type" TEXT NOT NULL,
"categorie" TEXT NOT NULL,
"modifier" DOUBLE PRECISION NOT NULL,
"bank_code" TEXT NOT NULL,
CONSTRAINT "bank_codes_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "leave_requests" ADD CONSTRAINT "leave_requests_bank_code_id_fkey" FOREIGN KEY ("bank_code_id") REFERENCES "bank_codes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "shifts" ADD CONSTRAINT "shifts_bank_code_id_fkey" FOREIGN KEY ("bank_code_id") REFERENCES "bank_codes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "expenses" ADD CONSTRAINT "expenses_bank_code_id_fkey" FOREIGN KEY ("bank_code_id") REFERENCES "bank_codes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -60,7 +60,7 @@ model EmployeesArchive {
archived_at DateTime @default(now())
user_id String @db.Uuid
user Users @relation("UsersToEmployeesToArchive",fields: [user_id], references: [id])
user Users @relation("UsersToEmployeesToArchive", fields: [user_id], references: [id])
first_name String
last_name String
@ -132,7 +132,7 @@ model LeaveRequestsArchive {
//pay-period vue
view PayPeriods {
period_number Int
period_number Int @id
start_date DateTime @db.Date
end_date DateTime @db.Date
year Int