18 lines
726 B
SQL
18 lines
726 B
SQL
CREATE TABLE "InfrastructureAlertCollection" (
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
"observedAt" TIMESTAMP(3) NOT NULL
|
|
);
|
|
CREATE TABLE "InfrastructureAlertEvent" (
|
|
"id" TEXT NOT NULL PRIMARY KEY,
|
|
"fingerprint" TEXT NOT NULL,
|
|
"activeAt" TIMESTAMP(3) NOT NULL,
|
|
"payload" JSONB NOT NULL,
|
|
"lastObservedAt" TIMESTAMP(3) NOT NULL,
|
|
"recoveredAt" TIMESTAMP(3),
|
|
"clearedAt" TIMESTAMP(3),
|
|
"clearedBy" TEXT,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
CREATE UNIQUE INDEX "InfrastructureAlertEvent_fingerprint_activeAt_key" ON "InfrastructureAlertEvent"("fingerprint", "activeAt");
|
|
CREATE INDEX "InfrastructureAlertEvent_clearedAt_activeAt_idx" ON "InfrastructureAlertEvent"("clearedAt", "activeAt");
|