Skip to content

Commit

Permalink
fix: improve boolean type handling in PostgreSQL datasource
Browse files Browse the repository at this point in the history
Co-Authored-By: andy@juicyllama.com <andy@juicyllama.com>
  • Loading branch information
devin-ai-integration[bot] and andyslack committed Jan 22, 2025
1 parent 84f93e2 commit cfc0110
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/datasources/postgres.datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,10 @@ export class Postgres {
switch (column.type) {
case DataSourceColumnType.BOOLEAN:
// PostgreSQL supports native boolean type, so we just ensure it's a boolean
options.data[column.field] = Boolean(options.data[column.field])
// Only convert to boolean if it's not already a boolean
if (typeof options.data[column.field] !== 'boolean') {
options.data[column.field] = Boolean(options.data[column.field])
}
break
case DataSourceColumnType.DATE:
if (options.data[column.field]) {
Expand Down Expand Up @@ -682,7 +685,8 @@ export class Postgres {
switch (type) {
case DataSourceColumnType.BOOLEAN:
// PostgreSQL returns native boolean values, so we just ensure it's a proper boolean
return Boolean(value)
// Only convert to boolean if it's not already a boolean
return typeof value === 'boolean' ? value : Boolean(value)
case DataSourceColumnType.DATE:
return new Date(value).toISOString()
case DataSourceColumnType.NUMBER:
Expand Down

0 comments on commit cfc0110

Please sign in to comment.