sql camel case

This commit is contained in:
Benjamin Wilson
2025-02-25 19:11:10 -05:00
parent 864867ffd4
commit 19f49b74e6
@@ -50,22 +50,22 @@ export class ClientStatisticsService {
// Step 2: Use a temp table and single UPDATE // Step 2: Use a temp table and single UPDATE
await this.clientStatisticsRepository.query(` await this.clientStatisticsRepository.query(`
CREATE TEMP TABLE temp_stats ( CREATE TEMP TABLE temp_stats (
clientId UUID, "clientId" UUID,
time BIGINT, time BIGINT,
shares INT, shares INT,
acceptedCount INT, "acceptedCount" INT,
updatedAt TIMESTAMP "updatedAt" TIMESTAMP
) ON COMMIT DROP; ) ON COMMIT DROP;
INSERT INTO temp_stats (clientId, time, shares, acceptedCount, updatedAt) INSERT INTO temp_stats ("clientId", time, shares, "acceptedCount", "updatedAt")
VALUES ${values}; VALUES ${values};
UPDATE "client_statistics_entity" cse UPDATE "client_statistics_entity" cse
SET shares = ts.shares, SET shares = ts.shares,
acceptedCount = ts.acceptedCount, "acceptedCount" = ts."acceptedCount",
updatedAt = ts.updatedAt "updatedAt" = ts."updatedAt"
FROM temp_stats ts FROM temp_stats ts
WHERE cse.clientId = ts.clientId AND cse.time = ts.time; WHERE cse."clientId" = ts."clientId" AND cse.time = ts.time;
`); `);
this.bulkAsyncUpdates = []; this.bulkAsyncUpdates = [];