-- 验收测试表
CREATE TABLE IF NOT EXISTS "AcceptanceTest" (
    "id"              TEXT NOT NULL,
    "orgId"           TEXT NOT NULL,
    "verifierName"    TEXT NOT NULL,
    "results"         JSONB NOT NULL,
    "remarks"         JSONB NOT NULL,
    "conclusionName"  TEXT,
    "conclusionDate"  TEXT,
    "conclusionResult" TEXT,
    "conclusionIssues" TEXT,
    "screenshots"      JSONB,
    "signature1"       TEXT,
    "signature2"       TEXT,
    "status"          TEXT NOT NULL DEFAULT 'DRAFT',
    "submittedAt"     TIMESTAMP(3),
    "createdBy"       TEXT NOT NULL,
    "createdAt"       TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt"       TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT "AcceptanceTest_pkey" PRIMARY KEY ("id")
);

-- 唯一约束：同一组织下验收人姓名唯一
CREATE UNIQUE INDEX IF NOT EXISTS "AcceptanceTest_orgId_verifierName_key" ON "AcceptanceTest"("orgId", "verifierName");

-- 索引
CREATE INDEX IF NOT EXISTS "AcceptanceTest_orgId_status_idx" ON "AcceptanceTest"("orgId", "status");
