@@ -439,12 +439,13 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
439439 Array . isArray ( value . set )
440440 ) {
441441 // deal with nested "set" for scalar lists
442- createFields [ field ] = this . dialect . transformInput ( value . set , fieldDef . type as BuiltinType , true ) ;
442+ createFields [ field ] = this . dialect . transformInput ( value . set , fieldDef . type as BuiltinType , true , fieldDef ) ;
443443 } else {
444444 createFields [ field ] = this . dialect . transformInput (
445445 value ,
446446 fieldDef . type as BuiltinType ,
447447 ! ! fieldDef . array ,
448+ fieldDef ,
448449 ) ;
449450 }
450451 } else {
@@ -887,7 +888,7 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
887888 for ( const [ name , value ] of Object . entries ( item ) ) {
888889 const fieldDef = this . requireField ( model , name ) ;
889890 invariant ( ! fieldDef . relation , 'createMany does not support relations' ) ;
890- newItem [ name ] = this . dialect . transformInput ( value , fieldDef . type as BuiltinType , ! ! fieldDef . array ) ;
891+ newItem [ name ] = this . dialect . transformInput ( value , fieldDef . type as BuiltinType , ! ! fieldDef . array , fieldDef ) ;
891892 }
892893 if ( fromRelation ) {
893894 for ( const { fk, pk } of relationKeyPairs ) {
@@ -925,6 +926,7 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
925926 fieldDef . default ,
926927 fieldDef . type as BuiltinType ,
927928 ! ! fieldDef . array ,
929+ fieldDef ,
928930 ) ;
929931 }
930932 }
@@ -1057,11 +1059,12 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
10571059 generated ,
10581060 fieldDef . type as BuiltinType ,
10591061 ! ! fieldDef . array ,
1062+ fieldDef ,
10601063 ) ;
10611064 }
10621065 } else if ( fieldDef ?. updatedAt ) {
10631066 // TODO: should this work at kysely level instead?
1064- values [ field ] = this . dialect . transformInput ( new Date ( ) , 'DateTime' , false ) ;
1067+ values [ field ] = this . dialect . transformInput ( new Date ( ) , 'DateTime' , false , fieldDef ) ;
10651068 } else if ( fieldDef ?. default !== undefined ) {
10661069 let value = fieldDef . default ;
10671070 if ( fieldDef . type === 'Json' ) {
@@ -1072,7 +1075,7 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
10721075 value = JSON . parse ( value ) ;
10731076 }
10741077 }
1075- values [ field ] = this . dialect . transformInput ( value , fieldDef . type as BuiltinType , ! ! fieldDef . array ) ;
1078+ values [ field ] = this . dialect . transformInput ( value , fieldDef . type as BuiltinType , ! ! fieldDef . array , fieldDef ) ;
10761079 }
10771080 }
10781081 }
@@ -1176,7 +1179,7 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
11761179 if ( finalData === data ) {
11771180 finalData = clone ( data ) ;
11781181 }
1179- finalData [ fieldName ] = this . dialect . transformInput ( new Date ( ) , 'DateTime' , false ) ;
1182+ finalData [ fieldName ] = this . dialect . transformInput ( new Date ( ) , 'DateTime' , false , fieldDef ) ;
11801183 autoUpdatedFields . push ( fieldName ) ;
11811184 }
11821185 }
@@ -1442,7 +1445,7 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
14421445 return this . transformScalarListUpdate ( model , field , fieldDef , data [ field ] ) ;
14431446 }
14441447
1445- return this . dialect . transformInput ( data [ field ] , fieldDef . type as BuiltinType , ! ! fieldDef . array ) ;
1448+ return this . dialect . transformInput ( data [ field ] , fieldDef . type as BuiltinType , ! ! fieldDef . array , fieldDef ) ;
14461449 }
14471450
14481451 private isNumericIncrementalUpdate ( fieldDef : FieldDef , value : any ) {
@@ -1500,7 +1503,7 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
15001503 ) ;
15011504
15021505 const key = Object . keys ( payload ) [ 0 ] ;
1503- const value = this . dialect . transformInput ( payload [ key ! ] , fieldDef . type as BuiltinType , false ) ;
1506+ const value = this . dialect . transformInput ( payload [ key ! ] , fieldDef . type as BuiltinType , false , fieldDef ) ;
15041507 const eb = expressionBuilder < any , any > ( ) ;
15051508 const fieldRef = this . dialect . fieldRef ( model , field ) ;
15061509
@@ -1523,7 +1526,7 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
15231526 ) {
15241527 invariant ( Object . keys ( payload ) . length === 1 , 'Only one of "set", "push" can be provided' ) ;
15251528 const key = Object . keys ( payload ) [ 0 ] ;
1526- const value = this . dialect . transformInput ( payload [ key ! ] , fieldDef . type as BuiltinType , true ) ;
1529+ const value = this . dialect . transformInput ( payload [ key ! ] , fieldDef . type as BuiltinType , true , fieldDef ) ;
15271530 const eb = expressionBuilder < any , any > ( ) ;
15281531 const fieldRef = this . dialect . fieldRef ( model , field ) ;
15291532
0 commit comments