Skip to content

Bun.sql support for postgres.js debug option #25423

@madmoizo

Description

@madmoizo

What is the problem this feature would solve?

Being able to log queries to the console in development mode.

What is the feature you are proposing to solve the problem?

implement the postgres.js debug option:

Bun.SQL(process.env.DATABASE_URL as string, {
	debug:
		process.env.NODE_ENV === "development"
			? (connection, query, parameters, types) => {
				console.log("\x1b[96m[QUERY]\x1b[0m", JSON.stringify(parameters))
				console.log(query.replace(/\s+/g, " "))
			}
			: false
})

What alternatives have you considered?

Keep using postgres.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions