@@ -19,6 +19,7 @@ import type { DrizzleAdapter, GenericColumn } from '../types.js'
1919import type { BuildQueryJoinAliases } from './buildQuery.js'
2020
2121import { isPolymorphicRelationship } from '../utilities/isPolymorphicRelationship.js'
22+ import { isUUIDType } from '../utilities/isUUIDType.js'
2223import { jsonBuildObject } from '../utilities/json.js'
2324import { DistinctSymbol } from '../utilities/rawConstraint.js'
2425import { resolveBlockTableName } from '../utilities/validateExistingBlockIsIdentical.js'
@@ -111,7 +112,7 @@ export const getTableColumnFromPath = ({
111112 constraints,
112113 field : {
113114 name : 'id' ,
114- type : adapter . idType === 'uuid' ? 'text' : 'number' ,
115+ type : isUUIDType ( adapter . idType ) ? 'text' : 'number' ,
115116 } as NumberField | TextField ,
116117 table : adapter . tables [ newTableName ] ,
117118 }
@@ -414,7 +415,7 @@ export const getTableColumnFromPath = ({
414415 constraints,
415416 field : {
416417 name : 'id' ,
417- type : adapter . idType === 'uuid' ? 'text' : 'number' ,
418+ type : isUUIDType ( adapter . idType ) ? 'text' : 'number' ,
418419 } as NumberField | TextField ,
419420 table : aliasRelationshipTable ,
420421 }
@@ -531,7 +532,7 @@ export const getTableColumnFromPath = ({
531532 constraints,
532533 field : {
533534 name : 'id' ,
534- type : adapter . idType === 'uuid' ? 'text' : 'number' ,
535+ type : isUUIDType ( adapter . idType ) ? 'text' : 'number' ,
535536 } as NumberField | TextField ,
536537 table : newAliasTable ,
537538 }
@@ -706,8 +707,9 @@ export const getTableColumnFromPath = ({
706707
707708 const columns : TableColumn [ 'columns' ] = field . relationTo
708709 . map ( ( relationTo ) => {
709- let idType : 'number' | 'text' | 'uuid' =
710- adapter . idType === 'uuid' ? 'uuid' : 'number'
710+ let idType : 'number' | 'text' | 'uuid' = isUUIDType ( adapter . idType )
711+ ? 'uuid'
712+ : 'number'
711713
712714 const { customIDType } = adapter . payload . collections [ relationTo ]
713715
0 commit comments