fix(org): build the deleteOrg child test under the pg config

deleteOrg.childTest.ts read its leftover counts with db.get(sql...), a better-sqlite3 driver method. The pg config type-checks the same file with the pg driver's types, where .get() does not exist, so build-postgres failed on PR #3895's head (TS2339 at deleteOrg.childTest.ts:108) and main has carried the break since the merge landed 40 seconds before the job reported red. Read the counts through the query builder instead - the same .select({ count: count() }) shape deleteOrg.ts itself uses, which compiles under both configs - keeping the observations JSON the parent test parses unchanged.

Signed-off-by: Manas Choksi <12302040701105@mbit.edu.in>
Signed-off-by: choksi2212 <choksi2212@users.noreply.github.com>
This commit is contained in:
choksi2212
2026-10-13 23:11:28 +05:30
parent c66d0e973f
commit 9242c2c196
+17 -17
View File
@@ -16,7 +16,7 @@ import {
newtSessions,
clientSitesAssociationsCache
} from "@server/db";
import { sql } from "drizzle-orm";
import { count, eq } from "drizzle-orm";
const peerRemovals: string[] = [];
const server = http.createServer((req, res) => {
@@ -105,28 +105,28 @@ server.listen(0, "127.0.0.1", async () => {
const result = await deleteOrgById("org1");
const row = (await db.get(
sql`select
(select count(*) from sites) as sites,
(select count(*) from "newt") as newts,
(select count(*) from "newtSession") as sessions,
(select count(*) from clientSitesAssociationsCache where siteId = 3) as assoc`
)) as {
sites: number;
newts: number;
sessions: number;
assoc: number;
};
// Read the leftovers through the query builder, not db.get(): the
// pg build type-checks this file against the pg driver too, and
// .get() exists only on the sqlite driver.
const [sitesRow] = await db.select({ count: count() }).from(sites);
const [newtsRow] = await db.select({ count: count() }).from(newts);
const [sessionsRow] = await db
.select({ count: count() })
.from(newtSessions);
const [assocRow] = await db
.select({ count: count() })
.from(clientSitesAssociationsCache)
.where(eq(clientSitesAssociationsCache.siteId, 3));
console.log(
"OBSERVATIONS " +
JSON.stringify({
peerRemovals: peerRemovals.slice().sort(),
terminatedNewtIds: result.deletedNewtIds.slice().sort(),
sitesLeft: Number(row.sites),
newtsLeft: Number(row.newts),
sessionsLeft: Number(row.sessions),
associationRowsLeft: Number(row.assoc)
sitesLeft: sitesRow.count,
newtsLeft: newtsRow.count,
sessionsLeft: sessionsRow.count,
associationRowsLeft: assocRow.count
})
);
server.close();