@@ -102,6 +102,8 @@ type ColumnToType<T> = T extends UuidColumnSymbol
102102 ? string
103103 : T extends NumericColumnSymbol
104104 ? number
105+ : T extends BigIntColumnSymbol
106+ ? bigint
105107 : T extends DateColumnSymbol
106108 ? string | Date
107109 : T extends DateWithTimeZoneColumnSymbol
@@ -134,6 +136,7 @@ type RelatedColumns<T> = RemoveNeverFlat<{
134136 T [ K ] extends StringColumnTypeDef < infer M > ? StringColumnSymbol
135137 : T [ K ] extends UuidColumnTypeDef < infer M > ? UuidColumnSymbol
136138 : T [ K ] extends NumericColumnTypeDef < infer M > ? NumericColumnSymbol
139+ : T [ K ] extends BigIntColumnTypeDef < infer M > ? BigIntColumnSymbol
137140 : T [ K ] extends DateColumnTypeDef < infer M > ? DateColumnSymbol
138141 : T [ K ] extends DateWithTimeZoneColumnTypeDef < infer M > ? DateWithTimeZoneColumnSymbol
139142 : T [ K ] extends BinaryColumnTypeDef < infer M > ? BinaryColumnSymbol
@@ -149,6 +152,7 @@ type RelatedColumns<T> = RemoveNeverFlat<{
149152type AggregateColumns < T > = RemoveNeverFlat < {
150153 [ K in keyof T ] :
151154 T [ K ] extends NumericColumnTypeDef < infer M > ? NumericColumnSymbol
155+ : T [ K ] extends BigIntColumnTypeDef < infer M > ? BigIntColumnSymbol
152156 : T [ K ] extends ManyRelation
153157 ? AggregateColumns < T [ K ] >
154158 : T [ K ] extends RelatedTable
@@ -174,6 +178,7 @@ type ColumnSymbols =
174178 | StringColumnSymbol
175179 | UuidColumnSymbol
176180 | NumericColumnSymbol
181+ | BigIntColumnSymbol
177182 | DateColumnSymbol
178183 | DateWithTimeZoneColumnSymbol
179184 | BooleanColumnSymbol
@@ -245,6 +250,8 @@ type ToColumnTypes<T> = {
245250 ? StringColumnSymbol
246251 : T [ K ] extends NumericColumnSymbol
247252 ? NumericColumnSymbol
253+ : T [ K ] extends BigIntColumnSymbol
254+ ? BigIntColumnSymbol
248255 : T [ K ] extends DateColumnSymbol
249256 ? DateColumnSymbol
250257 : T [ K ] extends DateWithTimeZoneColumnSymbol
@@ -593,6 +600,12 @@ type NumericColumnSymbol = {
593600type NumericColumnType < M > = M &
594601 NumericColumnSymbol ;
595602
603+ type BigIntColumnSymbol = {
604+ [ ' isBigInt' ] : true ;
605+ } ;
606+ type BigIntColumnType < M > = M &
607+ BigIntColumnSymbol ;
608+
596609type JSONColumnSymbol = {
597610 [ ' isJSON' ] : true ;
598611} ;
@@ -621,6 +634,7 @@ interface ColumnType<M> {
621634 string ( ) : StringColumnTypeDef < M & StringColumnSymbol > ;
622635 uuid ( ) : UuidColumnTypeDef < M & UuidColumnSymbol > ;
623636 numeric ( ) : NumericColumnTypeDef < M & NumericColumnSymbol > ;
637+ bigint ( ) : BigIntColumnTypeDef < M & BigIntColumnSymbol > ;
624638 date ( ) : DateColumnTypeDef < M & DateColumnSymbol > ;
625639 dateWithTimeZone ( ) : DateWithTimeZoneColumnTypeDef < M & DateWithTimeZoneColumnSymbol > ;
626640 binary ( ) : BinaryColumnTypeDef < M & BinaryColumnSymbol > ;
@@ -657,6 +671,15 @@ type NumericValidator<M> = M extends NotNull
657671 validator : ( value ?: number | null ) => void
658672 ) : NumericColumnTypeDef < M > ;
659673 } ;
674+ type BigIntValidator < M > = M extends NotNull
675+ ? {
676+ validate ( validator : ( value : bigint ) => void ) : BigIntColumnTypeDef < M > ;
677+ }
678+ : {
679+ validate (
680+ validator : ( value ?: bigint | null ) => void
681+ ) : BigIntColumnTypeDef < M > ;
682+ } ;
660683type BinaryValidator < M > = M extends NotNull
661684 ? {
662685 validate ( validator : ( value : string ) => void ) : BinaryColumnTypeDef < M > ;
@@ -732,6 +755,17 @@ type NumericColumnTypeDef<M> = NumericValidator<M> & {
732755} & ColumnTypeOf < NumericColumnType < M > > &
733756 M ;
734757
758+ type BigIntColumnTypeDef < M > = BigIntValidator < M > & {
759+ primary ( ) : BigIntColumnTypeDef < M & IsPrimary > & IsPrimary ;
760+ notNull ( ) : BigIntColumnTypeDef < M & NotNull > & NotNull ;
761+ notNullExceptInsert ( ) : BigIntColumnTypeDef < M & NotNull & NotNullExceptInsert > & NotNull & NotNullExceptInsert ;
762+ serializable ( value : boolean ) : BigIntColumnTypeDef < M > ;
763+ JSONSchema ( schema : object , options ?: Options ) : BigIntColumnTypeDef < M > ;
764+ default ( value : bigint | null | undefined | ( ( ) => bigint | null | undefined ) ) : BigIntColumnTypeDef < M > ;
765+ dbNull ( value : bigint ) : BigIntColumnTypeDef < M > ;
766+ } & ColumnTypeOf < BigIntColumnType < M > > &
767+ M ;
768+
735769type UuidColumnTypeDef < M > = UuidValidator < M > & {
736770 primary ( ) : UuidColumnTypeDef < M & IsPrimary > & IsPrimary ;
737771 notNull ( ) : UuidColumnTypeDef < M & NotNull > & NotNull ;
@@ -992,6 +1026,11 @@ type ColumnToSchemaType<T> =
9921026 & ( T extends NotNullExceptInsert ? { ' notNull' : true ; ' notNullExceptInsert' : true }
9931027 : T extends NotNull ? { ' notNull' : true }
9941028 : { } ) :
1029+ T extends BigIntColumnSymbol
1030+ ? { ' type' : 'bigint' }
1031+ & ( T extends NotNullExceptInsert ? { ' notNull' : true ; ' notNullExceptInsert' : true }
1032+ : T extends NotNull ? { ' notNull' : true }
1033+ : { } ) :
9951034 T extends DateColumnSymbol | DateWithTimeZoneColumnSymbol
9961035 ? { ' type' : 'date' }
9971036 & ( T extends NotNullExceptInsert ? { ' notNull' : true ; ' notNullExceptInsert' : true }
0 commit comments