fix: fix monitor data sorting problem, add order by and add created at for fetch monitor data
This commit is contained in:
parent
f9ea835dac
commit
023a6573a1
@ -0,0 +1,2 @@
|
||||
-- CreateIndex
|
||||
CREATE INDEX "MonitorData_createdAt_idx" ON "MonitorData"("createdAt");
|
@ -292,6 +292,8 @@ model MonitorData {
|
||||
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
||||
|
||||
monitor Monitor @relation(fields: [monitorId], references: [id], onUpdate: Cascade, onDelete: Cascade)
|
||||
|
||||
@@index([createdAt])
|
||||
}
|
||||
|
||||
// Use for record latest monitor status, for example tls status
|
||||
|
@ -37,6 +37,9 @@ export function getMonitorData(
|
||||
value: true,
|
||||
createdAt: true,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'asc',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user