-- CreateTable
CREATE TABLE "platform_automation"."dingtalk_annual_leave_release_plans" (
    "id" UUID NOT NULL,
    "user_id" TEXT NOT NULL,
    "employee_name" TEXT NOT NULL,
    "employee_number" TEXT NOT NULL DEFAULT '',
    "year" INTEGER NOT NULL,
    "status" TEXT NOT NULL DEFAULT '正常',
    "join_date" DATE,
    "work_start_date" DATE,
    "adjustment_days" DECIMAL(10,2) NOT NULL DEFAULT 0,
    "not_count_days" INTEGER NOT NULL DEFAULT 0,
    "total_days" INTEGER NOT NULL DEFAULT 0,
    "release_schedule" JSONB NOT NULL DEFAULT '[]',
    "last_calculated_at" TIMESTAMPTZ(3) NOT NULL,
    "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMPTZ(3) NOT NULL,

    CONSTRAINT "dingtalk_annual_leave_release_plans_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "dingtalk_annual_leave_release_plans_year_idx" ON "platform_automation"."dingtalk_annual_leave_release_plans"("year");

-- CreateIndex
CREATE INDEX "dingtalk_annual_leave_release_plans_status_idx" ON "platform_automation"."dingtalk_annual_leave_release_plans"("status");

-- CreateIndex
CREATE INDEX "dingtalk_annual_leave_release_plans_user_id_idx" ON "platform_automation"."dingtalk_annual_leave_release_plans"("user_id");

-- CreateIndex
CREATE INDEX "dingtalk_annual_leave_release_plans_last_calculated_at_idx" ON "platform_automation"."dingtalk_annual_leave_release_plans"("last_calculated_at");

-- CreateIndex
CREATE UNIQUE INDEX "dingtalk_annual_leave_release_plans_user_year_key" ON "platform_automation"."dingtalk_annual_leave_release_plans"("user_id", "year");
