Files
ubi-dan-itam/prisma/migrations/20260731075337_add_employee/migration.sql
T
toanhoang 4c69bcf2c1 feat: add Employee Prisma model + migration
Employee directory entity per docs/asset-license-management.md's data
model table (id, name, department, manager). department stays a plain
String for now (not a separate Department entity). managerId is a
nullable self-relation (EmployeeManager) - top-level employees have
managerId = null.
2026-07-31 14:53:57 +07:00

14 lines
449 B
SQL

-- CreateTable
CREATE TABLE "employees" (
"id" UUID NOT NULL,
"name" TEXT NOT NULL,
"department" TEXT NOT NULL,
"manager_id" UUID,
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "employees_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "employees" ADD CONSTRAINT "employees_manager_id_fkey" FOREIGN KEY ("manager_id") REFERENCES "employees"("id") ON DELETE SET NULL ON UPDATE CASCADE;