feat: add user update info to history

This commit is contained in:
Methapon2001 2024-06-28 09:31:17 +07:00
parent 3e3d2cf01c
commit 123210c2dd
3 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,14 @@
-- CreateTable
CREATE TABLE "EmployeeHistory" (
"id" TEXT NOT NULL,
"field" TEXT NOT NULL,
"valueBefore" JSONB NOT NULL,
"valueAfter" JSONB NOT NULL,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"masterId" TEXT NOT NULL,
CONSTRAINT "EmployeeHistory_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "EmployeeHistory" ADD CONSTRAINT "EmployeeHistory_masterId_fkey" FOREIGN KEY ("masterId") REFERENCES "Employee"("id") ON DELETE CASCADE ON UPDATE CASCADE;