mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-08 08:02:27 +00:00
fix: pg types conversion dbstudio (#3636)
This commit is contained in:
@@ -12,9 +12,9 @@ function deleteWithAllValues(table: string, columns: ColumnDef[], dbType: DbType
|
||||
const conditions = columns
|
||||
.map(
|
||||
(c, i) =>
|
||||
`($${i + 1}::${c.datatype} IS NULL AND ${c.field} IS NULL OR ${c.field} = $${i + 1}::${
|
||||
c.datatype
|
||||
})`
|
||||
`($${i + 1}::text::${c.datatype} IS NULL AND ${c.field} IS NULL OR ${c.field} = $${
|
||||
i + 1
|
||||
}::text::${c.datatype})`
|
||||
)
|
||||
.join('\n AND ')
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ function updateWithAllValues(
|
||||
const conditions = columns
|
||||
.map(
|
||||
(c, i) =>
|
||||
`($${i + 2}::${c.datatype} IS NULL AND ${c.field} IS NULL OR ${c.field} = $${i + 2}::${
|
||||
c.datatype
|
||||
})`
|
||||
`($${i + 2}::text::${c.datatype} IS NULL AND ${c.field} IS NULL OR ${c.field} = $${
|
||||
i + 2
|
||||
}::text::${c.datatype})`
|
||||
)
|
||||
.join('\n AND ')
|
||||
|
||||
query += `\nUPDATE ${table} SET ${column.field} = $1::${column.datatype} \nWHERE ${conditions} RETURNING 1`
|
||||
query += `\nUPDATE ${table} SET ${column.field} = $1::text::${column.datatype} \nWHERE ${conditions} RETURNING 1`
|
||||
return query
|
||||
}
|
||||
case 'mysql': {
|
||||
|
||||
Reference in New Issue
Block a user