sozsoft-platform/configs/seeds/postgres/object/Hr_T_Timesheet.sql

40 lines
1.6 KiB
MySQL
Raw Normal View History

2026-10-06 11:24:30 +00:00
CREATE TABLE IF NOT EXISTS public."Hr_T_Timesheet"
(
"Id" uuid NOT NULL DEFAULT gen_random_uuid(),
"TenantId" uuid NULL,
"EmployeeId" uuid NOT NULL,
"WorkDate" date NOT NULL,
"PeriodYear" integer NOT NULL,
"PeriodMonth" integer NOT NULL,
"PeriodKey" varchar(48) NOT NULL,
"ShiftId" uuid NULL,
"DayType" varchar(16) NOT NULL DEFAULT 'Work',
"LeaveTypeId" uuid NULL,
"TrainingId" uuid NULL,
"FirstIn" timestamp NULL,
"LastOut" timestamp NULL,
"BreakMinutes" integer NOT NULL DEFAULT 0,
"NetMinutes" integer NOT NULL DEFAULT 0,
"NetHours" numeric(6, 2) NOT NULL DEFAULT 0,
"LateMinutes" integer NOT NULL DEFAULT 0,
"EarlyLeaveMinutes" integer NOT NULL DEFAULT 0,
"OvertimeHours" numeric(6, 2) NOT NULL DEFAULT 0,
"IsManual" boolean NOT NULL DEFAULT FALSE,
"IsIncomplete" boolean NOT NULL DEFAULT FALSE,
"IsAssumed" boolean NOT NULL DEFAULT FALSE,
"Note" varchar(512) NULL,
"CalculatedAt" timestamp NULL,
"CreationTime" timestamp NOT NULL DEFAULT (NOW() AT TIME ZONE 'UTC'),
"CreatorId" uuid NULL,
"LastModificationTime" timestamp NULL,
"LastModifierId" uuid NULL,
"IsDeleted" boolean NOT NULL DEFAULT FALSE,
"DeletionTime" timestamp NULL,
"DeleterId" uuid NULL,
CONSTRAINT "PK_Hr_T_Timesheet" PRIMARY KEY ("Id")
);
CREATE INDEX IF NOT EXISTS "IX_Hr_T_Timesheet_EmployeeDate" ON public."Hr_T_Timesheet" ("EmployeeId", "WorkDate") INCLUDE ("IsDeleted", "IsManual");
CREATE INDEX IF NOT EXISTS "IX_Hr_T_Timesheet_Period" ON public."Hr_T_Timesheet" ("TenantId", "PeriodYear", "PeriodMonth") INCLUDE ("EmployeeId", "DayType", "IsDeleted");