diff --git a/packages/cli/src/modules/data-table/utils/sql-utils.ts b/packages/cli/src/modules/data-table/utils/sql-utils.ts index 331422ed74d..d476a5dee3b 100644 --- a/packages/cli/src/modules/data-table/utils/sql-utils.ts +++ b/packages/cli/src/modules/data-table/utils/sql-utils.ts @@ -402,18 +402,18 @@ export function resolvePath( // difference we don't care for in the face of imminent removal of support const path = toSQLitePath(pathArray); const base = `json_extract(${ref}, '${path.replaceAll("'", "\\'")}')`; - // if (typeof value === 'number') { - // return `CAST(${base} as ${dataTableColumnTypeToSql('number', dbType)})`; - // } - // if (value instanceof Date) { - // return `CAST(${base} as ${dataTableColumnTypeToSql('date', dbType)})`; - // } - // if (typeof value === 'boolean') { - // return `CAST(${base} as ${dataTableColumnTypeToSql('boolean', dbType)})`; - // } - // if (typeof value === 'string') { - // return `CAST(${base} AS ${dataTableColumnTypeToSql('string', dbType)})`; - // } + if (typeof value === 'number') { + return `CAST(${base} as ${dataTableColumnTypeToSql('number', dbType)})`; + } + if (value instanceof Date) { + return `CAST(${base} as ${dataTableColumnTypeToSql('date', dbType)})`; + } + if (typeof value === 'boolean') { + return `CAST(${base} as ${dbType.startsWith('sqlite') ? dataTableColumnTypeToSql('boolean', dbType) : 'INTEGER'})`; + } + if (typeof value === 'string') { + return `CAST(${base} AS ${dataTableColumnTypeToSql('string', dbType)})`; + } // return `CAST(${base} AS ${dataTableColumnTypeToSql('string', dbType)})`; return base; }