Skip to content

Commit cd7b3b1

Browse files
🏯 Re-add support for destroy method.
I'm probably going to run into a lot of these problems. I wish I had tests for them.
1 parent 4cb00cf commit cd7b3b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/api/db/db-client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { snakeCase } from "lodash"
44

55
import { DB_CONFIG } from "@/config"
66

7-
import { NON_STANDARD_COLUMN_NAMES_TRANSFORMS } from '@/utils/db-wrap-identifier-helpers'
7+
import { NON_STANDARD_COLUMN_NAMES_TRANSFORMS } from "@/utils/db-wrap-identifier-helpers"
88

99
const db = knex({
1010
client: DB_CONFIG.client,
@@ -36,6 +36,8 @@ const dbWithSchema: Knex = new Proxy(db, {
3636
if (typeof target[prop] === "function") {
3737
if (prop === "withSchema") {
3838
return (schema: string) => target[prop](schema) // format taken from src/api/node_modules/knex/types/index.d.ts
39+
} else if (prop === "destroy") {
40+
return (callback: Function) => db.destroy(callback)
3941
} else {
4042
return (...args: any[]) => target[prop](...args).withSchema(DB_CONFIG.defaultSchema)
4143
}

0 commit comments

Comments
 (0)