refactor: add migration

This commit is contained in:
moonrailgun 2023-10-24 16:59:36 +08:00
parent 16ba3a8768
commit dd6b4943f9

View File

@ -0,0 +1,13 @@
-- CreateTable
CREATE TABLE "MonitorStatus" (
"monitorId" VARCHAR(30) NOT NULL,
"statusName" VARCHAR(50) NOT NULL,
"payload" JSON NOT NULL,
"createdAt" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMPTZ(6) NOT NULL,
CONSTRAINT "MonitorStatus_pkey" PRIMARY KEY ("monitorId","statusName")
);
-- AddForeignKey
ALTER TABLE "MonitorStatus" ADD CONSTRAINT "MonitorStatus_monitorId_fkey" FOREIGN KEY ("monitorId") REFERENCES "Monitor"("id") ON DELETE CASCADE ON UPDATE CASCADE;