@@ -216,18 +216,18 @@ A `PRIMARY KEY` constraint automatically has a `UNIQUE` constraint.
216
216
export const composite = pgTable (' composite_example' , {
217
217
id: integer (' id' ),
218
218
name: text (' name' ),
219
- }, (t ) => ( {
219
+ }, (t ) => [ {
220
220
unq: unique ().on (t .id , t .name ),
221
221
unq2: unique (' custom_name' ).on (t .id , t .name )
222
- }) );
222
+ }] );
223
223
224
224
// In Postgres 15.0+ NULLS NOT DISTINCT is available
225
225
// This example demonstrates both available usages
226
226
export const userNulls = pgTable (' user_nulls_example' , {
227
227
id: integer (' id' ).unique (" custom_name" , { nulls: ' not distinct' }),
228
- }, (t ) => ( {
228
+ }, (t ) => [ {
229
229
unq: unique ().on (t .id ).nullsNotDistinct ()
230
- }) );
230
+ }] );
231
231
```
232
232
233
233
``` sql
@@ -411,9 +411,9 @@ If you define a `CHECK` constraint on a table it can limit the values in certain
411
411
username: text ().notNull (),
412
412
age: integer (),
413
413
},
414
- (table ) => ( {
414
+ (table ) => [ {
415
415
checkConstraint: check (" age_check1" , sql ` ${table .age } > 21 ` ),
416
- })
416
+ }]
417
417
);
418
418
```
419
419
``` sql
@@ -629,10 +629,10 @@ Drizzle ORM provides a standalone `primaryKey` operator for that:
629
629
authorId: integer (" author_id" ),
630
630
bookId: integer (" book_id" ),
631
631
}, (table ) => {
632
- return {
632
+ return [ {
633
633
pk: primaryKey ({ columns: [table .bookId , table .authorId ] }),
634
634
pkWithCustomName: primaryKey ({ name: ' custom_name' , columns: [table .bookId , table .authorId ] }),
635
- };
635
+ }] ;
636
636
});
637
637
```
638
638
@@ -851,13 +851,13 @@ set return type for reference callback or use a standalone `foreignKey` operator
851
851
name: text (" name" ),
852
852
parentId: integer (" parent_id" ),
853
853
}, (table ) => {
854
- return {
854
+ return [ {
855
855
parentReference: foreignKey ({
856
856
columns: [table .parentId ],
857
857
foreignColumns: [table .id ],
858
858
name: " custom_fk"
859
859
}),
860
- };
860
+ }] ;
861
861
});
862
862
```
863
863
@@ -940,13 +940,13 @@ To declare multicolumn foreign keys you can use a dedicated `foreignKey` operato
940
940
userFirstName: text (" user_first_name" ),
941
941
userLastName: text (" user_last_name" ),
942
942
}, (table ) => {
943
- return {
943
+ return [ {
944
944
userReference: foreignKey ({
945
945
columns: [table .userFirstName , table .userLastName ],
946
946
foreignColumns: [user .firstName , user .lastName ]
947
947
name : " custom_fk"
948
948
})
949
- }
949
+ }]
950
950
})
951
951
```
952
952
0 commit comments