Skip to content

Commit d63068b

Browse files
committed
pg-sql2 allow comments to be explicitly always included
1 parent 64999fc commit d63068b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

utils/pg-sql2/src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ const isDev =
3333
(process.env.GRAPHILE_ENV === "development" ||
3434
process.env.GRAPHILE_ENV === "test");
3535

36-
const includeComments =
37-
typeof process !== "undefined" && process.env.PGSQL2_DEBUG === "1";
36+
const alwaysIncludeComments =
37+
isDev || (typeof process !== "undefined" && process.env.PGSQL2_DEBUG === "1");
3838

3939
const nodeInspect: CustomInspectFunction = function (
4040
this: SQLNode | SQLQuery,
@@ -1099,9 +1099,12 @@ export function placeholder(symbol: symbol, fallback?: SQL): SQL {
10991099
return makePlaceholderNode(symbol, fallback);
11001100
}
11011101

1102-
export function comment(commentText: string): SQLCommentNode | SQLRawNode {
1103-
if (includeComments) {
1104-
return makeCommentNode(commentText);
1102+
export function comment(
1103+
text: string,
1104+
always = false,
1105+
): SQLCommentNode | SQLRawNode {
1106+
if (always || alwaysIncludeComments) {
1107+
return makeCommentNode(text);
11051108
} else {
11061109
return sql.blank;
11071110
}

0 commit comments

Comments
 (0)