File tree Expand file tree Collapse file tree 11 files changed +464
-234
lines changed Expand file tree Collapse file tree 11 files changed +464
-234
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,8 @@ jobs:
187
187
188
188
services :
189
189
postgres :
190
- image : ${{ (startsWith(matrix.database, 'postgres') ) && 'postgis/postgis:16-3.4' || '' }}
190
+ # Custom postgres 17 docker image that supports both pg-vector and postgis: https://github.com/payloadcms/postgis-vector
191
+ image : ${{ (startsWith(matrix.database, 'postgres') ) && 'ghcr.io/payloadcms/postgis-vector:latest' || '' }}
191
192
env :
192
193
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
193
194
POSTGRES_USER : ${{ env.POSTGRES_USER }}
Original file line number Diff line number Diff line change 151
151
"create-payload-app" : " workspace:*" ,
152
152
"cross-env" : " 7.0.3" ,
153
153
"dotenv" : " 16.4.7" ,
154
- "drizzle-kit" : " 0.31.0 " ,
155
- "drizzle-orm" : " 0.43.1 " ,
154
+ "drizzle-kit" : " 0.31.4 " ,
155
+ "drizzle-orm" : " 0.44.2 " ,
156
156
"escape-html" : " ^1.0.3" ,
157
157
"execa" : " 5.1.1" ,
158
158
"form-data" : " 3.0.1" ,
166
166
"next" : " 15.3.2" ,
167
167
"open" : " ^10.1.0" ,
168
168
"p-limit" : " ^5.0.0" ,
169
- "pg" : " 8.11 .3" ,
169
+ "pg" : " 8.16 .3" ,
170
170
"playwright" : " 1.50.0" ,
171
171
"playwright-core" : " 1.50.0" ,
172
172
"prettier" : " 3.5.3" ,
Original file line number Diff line number Diff line change 78
78
"@payloadcms/drizzle" : " workspace:*" ,
79
79
"@types/pg" : " 8.10.2" ,
80
80
"console-table-printer" : " 2.12.1" ,
81
- "drizzle-kit" : " 0.31.1 " ,
81
+ "drizzle-kit" : " 0.31.4 " ,
82
82
"drizzle-orm" : " 0.44.2" ,
83
- "pg" : " 8.11 .3" ,
83
+ "pg" : " 8.16 .3" ,
84
84
"prompts" : " 2.4.2" ,
85
85
"to-snake-case" : " 1.0.0" ,
86
86
"uuid" : " 10.0.0"
Original file line number Diff line number Diff line change 76
76
"@libsql/client" : " 0.14.0" ,
77
77
"@payloadcms/drizzle" : " workspace:*" ,
78
78
"console-table-printer" : " 2.12.1" ,
79
- "drizzle-kit" : " 0.31.1 " ,
79
+ "drizzle-kit" : " 0.31.4 " ,
80
80
"drizzle-orm" : " 0.44.2" ,
81
81
"prompts" : " 2.4.2" ,
82
82
"to-snake-case" : " 1.0.0" ,
Original file line number Diff line number Diff line change 78
78
"@payloadcms/drizzle" : " workspace:*" ,
79
79
"@vercel/postgres" : " ^0.9.0" ,
80
80
"console-table-printer" : " 2.12.1" ,
81
- "drizzle-kit" : " 0.31.1 " ,
81
+ "drizzle-kit" : " 0.31.4 " ,
82
82
"drizzle-orm" : " 0.44.2" ,
83
- "pg" : " 8.11 .3" ,
83
+ "pg" : " 8.16 .3" ,
84
84
"prompts" : " 2.4.2" ,
85
85
"to-snake-case" : " 1.0.0" ,
86
86
"uuid" : " 10.0.0"
Original file line number Diff line number Diff line change @@ -24,20 +24,26 @@ export const columnToCodeConverter: ColumnToCodeConverter = ({
24
24
25
25
const columnBuilderArgsArray : string [ ] = [ ]
26
26
27
- if ( column . type === 'timestamp' ) {
28
- columnBuilderArgsArray . push ( `mode: '${ column . mode } '` )
29
- if ( column . withTimezone ) {
30
- columnBuilderArgsArray . push ( 'withTimezone: true' )
27
+ switch ( column . type ) {
28
+ case 'bit' :
29
+ case 'halfvec' :
30
+ case 'sparsevec' :
31
+ case 'vector' : {
32
+ if ( column . dimensions ) {
33
+ columnBuilderArgsArray . push ( `dimensions: ${ column . dimensions } ` )
34
+ }
35
+ break
31
36
}
32
-
33
- if ( typeof column . precision === 'number' ) {
34
- columnBuilderArgsArray . push ( `precision: ${ column . precision } ` )
35
- }
36
- }
37
-
38
- if ( column . type === 'vector' ) {
39
- if ( column . dimensions ) {
40
- columnBuilderArgsArray . push ( `dimensions: ${ column . dimensions } ` )
37
+ case 'timestamp' : {
38
+ columnBuilderArgsArray . push ( `mode: '${ column . mode } '` )
39
+ if ( column . withTimezone ) {
40
+ columnBuilderArgsArray . push ( 'withTimezone: true' )
41
+ }
42
+
43
+ if ( typeof column . precision === 'number' ) {
44
+ columnBuilderArgsArray . push ( `precision: ${ column . precision } ` )
45
+ }
46
+ break
41
47
}
42
48
}
43
49
Original file line number Diff line number Diff line change 1
1
import type { ForeignKeyBuilder , IndexBuilder } from 'drizzle-orm/pg-core'
2
2
3
3
import {
4
+ bit ,
4
5
boolean ,
5
6
foreignKey ,
7
+ halfvec ,
6
8
index ,
7
9
integer ,
8
10
jsonb ,
9
11
numeric ,
10
12
serial ,
13
+ sparsevec ,
11
14
text ,
12
15
timestamp ,
13
16
uniqueIndex ,
@@ -44,6 +47,14 @@ export const buildDrizzleTable = ({
44
47
45
48
for ( const [ key , column ] of Object . entries ( rawTable . columns ) ) {
46
49
switch ( column . type ) {
50
+ case 'bit' : {
51
+ const builder = bit ( column . name , { dimensions : column . dimensions } )
52
+
53
+ columns [ key ] = builder
54
+
55
+ break
56
+ }
57
+
47
58
case 'enum' :
48
59
if ( 'locale' in column ) {
49
60
columns [ key ] = adapter . enums . enum__locales ( column . name )
@@ -56,6 +67,21 @@ export const buildDrizzleTable = ({
56
67
}
57
68
break
58
69
70
+ case 'halfvec' : {
71
+ const builder = halfvec ( column . name , { dimensions : column . dimensions } )
72
+
73
+ columns [ key ] = builder
74
+ break
75
+ }
76
+
77
+ case 'sparsevec' : {
78
+ const builder = sparsevec ( column . name , { dimensions : column . dimensions } )
79
+
80
+ columns [ key ] = builder
81
+
82
+ break
83
+ }
84
+
59
85
case 'timestamp' : {
60
86
let builder = timestamp ( column . name , {
61
87
mode : column . mode ,
Original file line number Diff line number Diff line change @@ -281,12 +281,30 @@ export type VectorRawColumn = {
281
281
type : 'vector'
282
282
} & BaseRawColumn
283
283
284
+ export type HalfVecRawColumn = {
285
+ dimensions ?: number
286
+ type : 'halfvec'
287
+ } & BaseRawColumn
288
+
289
+ export type SparseVecRawColumn = {
290
+ dimensions ?: number
291
+ type : 'sparsevec'
292
+ } & BaseRawColumn
293
+
294
+ export type BinaryVecRawColumn = {
295
+ dimensions ?: number
296
+ type : 'bit'
297
+ } & BaseRawColumn
298
+
284
299
export type RawColumn =
285
300
| ( {
286
301
type : 'boolean' | 'geometry' | 'jsonb' | 'numeric' | 'serial' | 'text' | 'varchar'
287
302
} & BaseRawColumn )
303
+ | BinaryVecRawColumn
288
304
| EnumRawColumn
305
+ | HalfVecRawColumn
289
306
| IntegerRawColumn
307
+ | SparseVecRawColumn
290
308
| TimestampRawColumn
291
309
| UUIDRawColumn
292
310
| VectorRawColumn
You can’t perform that action at this time.
0 commit comments