@@ -2,7 +2,7 @@ import * as fs from 'fs';
22import * as path from 'path' ;
33import chalk from 'chalk' ;
44import * as yaml from 'js-yaml' ;
5- import { IntrospectedSchema , IntrospectedTable , IntrospectedColumn , ObjectConfig , IObjectQL , FieldConfig } from '@objectql/types' ;
5+ import { IntrospectedSchema , IntrospectedTable , IntrospectedColumn , ObjectConfig , IObjectQL , FieldConfig , FieldType } from '@objectql/types' ;
66
77interface SyncOptions {
88 config ?: string ;
@@ -167,7 +167,7 @@ function generateObjectDefinition(table: IntrospectedTable, schema: Introspected
167167 } else {
168168 // Regular field - map SQL type to ObjectQL type
169169 const fieldType = mapSqlTypeToObjectQL ( column . type , column ) ;
170- field . type = fieldType as any ; // Type assertion needed as mapSqlTypeToObjectQL returns string
170+ field . type = fieldType ;
171171
172172 // Add label
173173 field . label = formatLabel ( column . name ) ;
@@ -205,12 +205,12 @@ function generateObjectDefinition(table: IntrospectedTable, schema: Introspected
205205/**
206206 * Map SQL native type to ObjectQL field type
207207 */
208- function mapSqlTypeToObjectQL ( sqlType : string , column : IntrospectedColumn ) : string {
208+ function mapSqlTypeToObjectQL ( sqlType : string , column : IntrospectedColumn ) : FieldType {
209209 const type = sqlType . toLowerCase ( ) ;
210210
211- // Integer types
211+ // Integer types - map to 'number'
212212 if ( type . includes ( 'int' ) || type . includes ( 'serial' ) || type . includes ( 'bigserial' ) ) {
213- return 'integer ' ;
213+ return 'number ' ;
214214 }
215215
216216 // Float/Decimal types
@@ -240,9 +240,9 @@ function mapSqlTypeToObjectQL(sqlType: string, column: IntrospectedColumn): stri
240240 return 'textarea' ;
241241 }
242242
243- // JSON types
243+ // JSON types - map to 'object'
244244 if ( type . includes ( 'json' ) || type . includes ( 'jsonb' ) ) {
245- return 'json ' ;
245+ return 'object ' ;
246246 }
247247
248248 // Binary/Blob types
0 commit comments