Skip to content

Commit e559184

Browse files
committed
fix: hide notice logs from postgres in dev
1 parent 4994a64 commit e559184

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/features/database.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,18 @@ export { db, schema, client }
233233

234234
addServerScanDir(resolve('runtime/database/pglite-server'))
235235
}
236+
if (driver === 'postgres-js' && nuxt.options.dev) {
237+
// disable notice logger for postgres-js in dev
238+
drizzleOrmContent = `import { drizzle } from 'drizzle-orm/postgres-js'
239+
import postgres from 'postgres'
240+
241+
const client = postgres('${connection.url}', {
242+
onnotice: () => {}
243+
})
244+
const db = drizzle({ client });
245+
export { db, schema }
246+
`
247+
}
236248

237249
if (driver === 'd1') {
238250
// D1 requires binding from environment

0 commit comments

Comments
 (0)