-- P2-10: 自定义日历事件 CREATE TABLE "CalendarEvent" ( "id" TEXT NOT NULL, "orgId" TEXT NOT NULL, "title" TEXT NOT NULL, "date" TIMESTAMP(3) NOT NULL, "endDate" TIMESTAMP(3), "type" TEXT NOT NULL DEFAULT 'CUSTOM', "priority" TEXT NOT NULL DEFAULT 'medium', "location" TEXT, "description" TEXT, "employeeId" TEXT, "createdBy" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "CalendarEvent_pkey" PRIMARY KEY ("id") ); CREATE INDEX "CalendarEvent_orgId_date_idx" ON "CalendarEvent"("orgId", "date"); CREATE INDEX "CalendarEvent_orgId_type_idx" ON "CalendarEvent"("orgId", "type"); ALTER TABLE "CalendarEvent" ADD CONSTRAINT "CalendarEvent_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "Organization"("id") ON DELETE CASCADE; ALTER TABLE "CalendarEvent" ADD CONSTRAINT "CalendarEvent_employeeId_fkey" FOREIGN KEY ("employeeId") REFERENCES "Employee"("id") ON DELETE SET NULL;