mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-08-31 04:38:08 +00:00
Fix potential database schema errors in DNS metric queries
Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/5a1483f2-5559-4904-a47f-30fd75b76276.jpg
This commit is contained in:
@@ -450,15 +450,17 @@ export class DatabaseStorage implements IStorage {
|
|||||||
conditions.push(sql`${dnsMetrics.timestamp} <= ${endDate}`);
|
conditions.push(sql`${dnsMetrics.timestamp} <= ${endDate}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a single where with and() to combine all conditions
|
// Only select columns that we know exist to avoid DB schema issues
|
||||||
const results = await db.select({
|
const results = await db.select({
|
||||||
id: dnsMetrics.id,
|
id: dnsMetrics.id,
|
||||||
domainId: dnsMetrics.domainId,
|
domainId: dnsMetrics.domainId,
|
||||||
recordId: dnsMetrics.recordId,
|
recordId: dnsMetrics.recordId,
|
||||||
metricType: dnsMetrics.metricType,
|
metricType: dnsMetrics.metricType,
|
||||||
value: dnsMetrics.value,
|
value: dnsMetrics.value,
|
||||||
tags: dnsMetrics.tags,
|
timestamp: dnsMetrics.timestamp,
|
||||||
timestamp: dnsMetrics.timestamp
|
// Add empty/default values for columns that might be missing in the DB schema
|
||||||
|
source: sql`NULL::text`,
|
||||||
|
tags: sql`NULL::text[]`
|
||||||
})
|
})
|
||||||
.from(dnsMetrics)
|
.from(dnsMetrics)
|
||||||
.where(and(...conditions))
|
.where(and(...conditions))
|
||||||
|
|||||||
Reference in New Issue
Block a user