@@ -20,7 +20,7 @@ A signed integer, stored in `0`, `1`, `2`, `3`, `4`, `6`, or `8` bytes depending
20
20
21
21
<Section >
22
22
``` typescript
23
- import { int , singlestoreTable } from " drizzle-orm/mysql -core" ;
23
+ import { int , singlestoreTable } from " drizzle-orm/singlestore -core" ;
24
24
25
25
const table = singlestoreTable (' table' , {
26
26
int: int ()
@@ -38,7 +38,7 @@ CREATE TABLE `table` (
38
38
39
39
<Section >
40
40
``` typescript
41
- import { tinyint , singlestoreTable } from " drizzle-orm/mysql -core" ;
41
+ import { tinyint , singlestoreTable } from " drizzle-orm/singlestore -core" ;
42
42
43
43
const table = singlestoreTable (' table' , {
44
44
tinyint: tinyint ()
@@ -56,7 +56,7 @@ CREATE TABLE `table` (
56
56
57
57
<Section >
58
58
``` typescript
59
- import { smallint , singlestoreTable } from " drizzle-orm/mysql -core" ;
59
+ import { smallint , singlestoreTable } from " drizzle-orm/singlestore -core" ;
60
60
61
61
const table = singlestoreTable (' table' , {
62
62
smallint: smallint ()
@@ -74,7 +74,7 @@ CREATE TABLE `table` (
74
74
75
75
<Section >
76
76
``` typescript
77
- import { mediumint , singlestoreTable } from " drizzle-orm/mysql -core" ;
77
+ import { mediumint , singlestoreTable } from " drizzle-orm/singlestore -core" ;
78
78
79
79
const table = singlestoreTable (' table' , {
80
80
mediumint: mediumint ()
@@ -92,7 +92,7 @@ CREATE TABLE `table` (
92
92
93
93
<Section >
94
94
``` typescript
95
- import { bigint , singlestoreTable } from " drizzle-orm/mysql -core" ;
95
+ import { bigint , singlestoreTable } from " drizzle-orm/singlestore -core" ;
96
96
97
97
const table = singlestoreTable (' table' , {
98
98
bigint: bigint ({ mode: ' number' })
@@ -121,7 +121,7 @@ We've omitted config of `M` in `bigint(M)`, since it indicates the display width
121
121
122
122
<Section >
123
123
``` typescript
124
- import { real , singlestoreTable } from " drizzle-orm/mysql -core" ;
124
+ import { real , singlestoreTable } from " drizzle-orm/singlestore -core" ;
125
125
126
126
const table = singlestoreTable (' table' , {
127
127
real: real ()
@@ -137,7 +137,7 @@ CREATE TABLE `table` (
137
137
138
138
<Section >
139
139
``` typescript
140
- import { real , singlestoreTable } from " drizzle-orm/mysql -core" ;
140
+ import { real , singlestoreTable } from " drizzle-orm/singlestore -core" ;
141
141
142
142
const table = singlestoreTable (' table' , {
143
143
realPrecision: real ({ precision: 1 ,}),
@@ -157,7 +157,7 @@ CREATE TABLE `table` (
157
157
158
158
<Section >
159
159
``` typescript
160
- import { decimal , singlestoreTable } from " drizzle-orm/mysql -core" ;
160
+ import { decimal , singlestoreTable } from " drizzle-orm/singlestore -core" ;
161
161
162
162
const table = singlestoreTable (' table' , {
163
163
decimal: decimal ()
@@ -173,7 +173,7 @@ CREATE TABLE `table` (
173
173
174
174
<Section >
175
175
``` typescript
176
- import { decimal , singlestoreTable } from " drizzle-orm/mysql -core" ;
176
+ import { decimal , singlestoreTable } from " drizzle-orm/singlestore -core" ;
177
177
178
178
const table = singlestoreTable (' table' , {
179
179
decimalPrecision: decimal ({ precision: 1 ,}),
@@ -193,7 +193,7 @@ CREATE TABLE `table` (
193
193
194
194
<Section >
195
195
``` typescript
196
- import { double , singlestoreTable } from " drizzle-orm/mysql -core" ;
196
+ import { double , singlestoreTable } from " drizzle-orm/singlestore -core" ;
197
197
198
198
const table = singlestoreTable (' table' , {
199
199
double: double (' double' )
@@ -209,7 +209,7 @@ CREATE TABLE `table` (
209
209
210
210
<Section >
211
211
``` typescript
212
- import { double , singlestoreTable } from " drizzle-orm/mysql -core" ;
212
+ import { double , singlestoreTable } from " drizzle-orm/singlestore -core" ;
213
213
214
214
const table = singlestoreTable (' table' , {
215
215
doublePrecision: double ({ precision: 1 ,}),
@@ -229,7 +229,7 @@ CREATE TABLE `table` (
229
229
230
230
<Section >
231
231
``` typescript
232
- import { float , singlestoreTable } from " drizzle-orm/mysql -core" ;
232
+ import { float , singlestoreTable } from " drizzle-orm/singlestore -core" ;
233
233
234
234
const table = singlestoreTable (' table' , {
235
235
float: float ()
@@ -252,7 +252,7 @@ CREATE TABLE `table` (
252
252
` SERIAL ` is an alias for ` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE ` .
253
253
254
254
``` typescript
255
- import { serial , singlestoreTable } from " drizzle-orm/mysql -core" ;
255
+ import { serial , singlestoreTable } from " drizzle-orm/singlestore -core" ;
256
256
257
257
const table = singlestoreTable (' table' , {
258
258
serial: serial ()
@@ -272,7 +272,7 @@ CREATE TABLE `table` (
272
272
273
273
<Section >
274
274
``` typescript
275
- import { binary , singlestoreTable } from " drizzle-orm/mysql -core" ;
275
+ import { binary , singlestoreTable } from " drizzle-orm/singlestore -core" ;
276
276
277
277
const table = singlestoreTable (' table' , {
278
278
binary: binary ()
@@ -290,7 +290,7 @@ CREATE TABLE `table` (
290
290
291
291
<Section >
292
292
``` typescript
293
- import { varbinary , singlestoreTable } from " drizzle-orm/mysql -core" ;
293
+ import { varbinary , singlestoreTable } from " drizzle-orm/singlestore -core" ;
294
294
295
295
const table = singlestoreTable (' table' , {
296
296
varbinary: varbinary ({ length: 2 }),
@@ -310,7 +310,7 @@ CREATE TABLE `table` (
310
310
311
311
<Section >
312
312
``` typescript
313
- import { char , singlestoreTable } from " drizzle-orm/mysql -core" ;
313
+ import { char , singlestoreTable } from " drizzle-orm/singlestore -core" ;
314
314
315
315
const table = singlestoreTable (' table' , {
316
316
char: char (),
@@ -328,7 +328,7 @@ CREATE TABLE `table` (
328
328
You can define ` { enum: ["value1", "value2"] } ` config to infer ` insert ` and ` select ` types, it ** won't** check runtime values.
329
329
<Section >
330
330
``` typescript
331
- import { varchar , singlestoreTable } from " drizzle-orm/mysql -core" ;
331
+ import { varchar , singlestoreTable } from " drizzle-orm/singlestore -core" ;
332
332
333
333
const table = singlestoreTable (' table' , {
334
334
varchar: varchar ({ length: 2 }),
@@ -351,7 +351,7 @@ You can define `{ enum: ["value1", "value2"] }` config to infer `insert` and `se
351
351
352
352
<Section >
353
353
``` typescript
354
- import { text , singlestoreTable } from " drizzle-orm/mysql -core" ;
354
+ import { text , singlestoreTable } from " drizzle-orm/singlestore -core" ;
355
355
356
356
const table = singlestoreTable (' table' , {
357
357
text: text (),
@@ -374,7 +374,7 @@ CREATE TABLE `table` (
374
374
375
375
<Section >
376
376
``` typescript
377
- import { boolean , singlestoreTable } from " drizzle-orm/mysql -core" ;
377
+ import { boolean , singlestoreTable } from " drizzle-orm/singlestore -core" ;
378
378
379
379
const table = singlestoreTable (' table' , {
380
380
boolean: boolean (),
@@ -394,7 +394,7 @@ CREATE TABLE `table` (
394
394
395
395
<Section >
396
396
``` typescript
397
- import { boolean , singlestoreTable } from " drizzle-orm/mysql -core" ;
397
+ import { boolean , singlestoreTable } from " drizzle-orm/singlestore -core" ;
398
398
399
399
const table = singlestoreTable (' table' , {
400
400
date: date (),
@@ -412,7 +412,7 @@ CREATE TABLE `table` (
412
412
413
413
<Section >
414
414
``` typescript
415
- import { datetime , singlestoreTable } from " drizzle-orm/mysql -core" ;
415
+ import { datetime , singlestoreTable } from " drizzle-orm/singlestore -core" ;
416
416
417
417
const table = singlestoreTable (' table' , {
418
418
datetime: datetime (),
@@ -432,7 +432,7 @@ CREATE TABLE `table` (
432
432
433
433
<Section >
434
434
``` typescript
435
- import { time , singlestoreTable } from " drizzle-orm/mysql -core" ;
435
+ import { time , singlestoreTable } from " drizzle-orm/singlestore -core" ;
436
436
437
437
const table = singlestoreTable (' table' , {
438
438
time: time (),
@@ -450,7 +450,7 @@ CREATE TABLE `table` (
450
450
451
451
<Section >
452
452
``` typescript
453
- import { year , singlestoreTable } from " drizzle-orm/mysql -core" ;
453
+ import { year , singlestoreTable } from " drizzle-orm/singlestore -core" ;
454
454
455
455
const table = singlestoreTable (' table' , {
456
456
year: year (),
@@ -468,7 +468,7 @@ CREATE TABLE `table` (
468
468
469
469
<Section >
470
470
``` typescript
471
- import { timestamp , singlestoreTable } from " drizzle-orm/mysql -core" ;
471
+ import { timestamp , singlestoreTable } from " drizzle-orm/singlestore -core" ;
472
472
473
473
const table = singlestoreTable (' table' , {
474
474
timestamp: timestamp (),
@@ -486,7 +486,7 @@ CREATE TABLE `table` (
486
486
487
487
<Section >
488
488
``` typescript
489
- import { timestamp , singlestoreTable } from " drizzle-orm/mysql -core" ;
489
+ import { timestamp , singlestoreTable } from " drizzle-orm/singlestore -core" ;
490
490
491
491
const table = singlestoreTable (' table' , {
492
492
timestamp: timestamp ().defaultNow (),
@@ -506,7 +506,7 @@ CREATE TABLE `table` (
506
506
507
507
<Section >
508
508
``` typescript
509
- import { json , singlestoreTable } from " drizzle-orm/mysql -core" ;
509
+ import { json , singlestoreTable } from " drizzle-orm/singlestore -core" ;
510
510
511
511
const table = singlestoreTable (' table' , {
512
512
json: json (),
@@ -540,10 +540,10 @@ json: json().$type<string[]>().default({});
540
540
541
541
<Section >
542
542
``` typescript
543
- import { mysqlEnum , singlestoreTable } from " drizzle-orm/mysql -core" ;
543
+ import { singlestoreEnum , singlestoreTable } from " drizzle-orm/singlestore -core" ;
544
544
545
545
const table = singlestoreTable (' table' , {
546
- mysqlEnum: mysqlEnum ([' unknown' , ' known' , ' popular' ]),
546
+ singlestoreEnum: singlestoreEnum ([' unknown' , ' known' , ' popular' ]),
547
547
});
548
548
```
549
549
@@ -556,6 +556,62 @@ CREATE TABLE `table` (
556
556
557
557
## ---
558
558
559
+ ### vector
560
+
561
+ <Section >
562
+ ``` typescript
563
+ import { singlestoreTable , vector } from " drizzle-orm/singlestore-core" ;
564
+
565
+ const table = singlestoreTable (' table' , {
566
+ embedding: vector (" embedding" , { dimensions: 10 }),
567
+ });
568
+ ```
569
+
570
+ ``` sql
571
+ CREATE TABLE `table ` (
572
+ ` embedding` vector(10 )
573
+ );
574
+ ```
575
+ </Section >
576
+
577
+ You can specify ` elementType ` in order to change what element type the vector
578
+ consists of. This can be one of ` I8 ` , ` I16 ` , ` I32 ` , ` I64 ` , ` F32 ` , or ` F64 `
579
+
580
+ <Section >
581
+ ``` typescript
582
+ import { singlestoreTable , vector } from " drizzle-orm/singlestore-core" ;
583
+
584
+ const table = singlestoreTable (' table' , {
585
+ embedding: vector (" embedding" , { dimensions: 10 , elementType: ' I8' }),
586
+ });
587
+ ```
588
+
589
+ ``` sql
590
+ CREATE TABLE `table ` (
591
+ ` embedding` vector(10 , ' I8' )
592
+ );
593
+ ```
594
+ </Section >
595
+
596
+ ###### Helper functions
597
+
598
+ There are two helper functions useful for vector search queries in SingleStore:
599
+
600
+ <Section >
601
+ ``` typescript
602
+ import { dotProduct , euclideanDistance } from ' drizzle-orm/singlestore-core/expressions' ;
603
+
604
+ euclideanDistance (table .column , [3 , 1 , 2 ]);
605
+ dotProduct (table .column , [3 , 1 , 2 ]);
606
+ ```
607
+ ``` sql
608
+ table .column < - > ' [3, 1, 2]'
609
+ table .column < * > ' [3, 1, 2]`
610
+ ```
611
+ </Section>
612
+
613
+ ## ---
614
+
559
615
### Customizing data type
560
616
561
617
Every column builder has a `.$type()` method, which allows you to customize the data type of the column. This is useful, for example, with unknown or branded types.
@@ -578,7 +634,7 @@ const users = singlestoreTable('users', {
578
634
579
635
<Section>
580
636
```typescript
581
- import { int , singlestoreTable } from " drizzle-orm/mysql -core" ;
637
+ import { int, singlestoreTable } from "drizzle-orm/singlestore -core";
582
638
583
639
const table = singlestoreTable(' table' , {
584
640
int: int().notNull(),
@@ -604,7 +660,7 @@ a string constant, a blob constant, a signed-number, or any constant expression
604
660
605
661
<Section>
606
662
```typescript
607
- import { int , singlestoreTable } from " drizzle-orm/mysql -core" ;
663
+ import { int, singlestoreTable } from "drizzle-orm/singlestore -core";
608
664
609
665
const table = singlestoreTable(' table' , {
610
666
int: int().default(3),
@@ -627,7 +683,7 @@ These functions can assist you in utilizing various implementations such as `uui
627
683
</Callout>
628
684
629
685
```ts
630
- import { varchar , singlestoreTable } from " drizzle-orm/mysql -core" ;
686
+ import { varchar, singlestoreTable } from "drizzle-orm/singlestore -core";
631
687
import { createId } from ' @paralleldrive/ cuid2' ;
632
688
633
689
const table = singlestoreTable(' table' , {
@@ -648,7 +704,7 @@ when the row is inserted as well, and the returned value will be used as the col
648
704
</Callout>
649
705
650
706
```ts
651
- import { text , singlestoreTable } from " drizzle-orm/mysql -core" ;
707
+ import { text, singlestoreTable } from "drizzle-orm/singlestore -core";
652
708
653
709
const table = singlestoreTable(' table' , {
654
710
alwaysNull: text().$type<string | null>().$onUpdate(() => null),
@@ -659,7 +715,7 @@ const table = singlestoreTable('table', {
659
715
660
716
<Section>
661
717
```typescript
662
- import { int , singlestoreTable } from " drizzle-orm/mysql -core" ;
718
+ import { int, singlestoreTable } from "drizzle-orm/singlestore -core";
663
719
664
720
const table = singlestoreTable(' table' , {
665
721
int: int().primaryKey(),
@@ -677,7 +733,7 @@ CREATE TABLE `table` (
677
733
678
734
<Section>
679
735
```typescript
680
- import { int , singlestoreTable } from " drizzle-orm/mysql -core" ;
736
+ import { int, singlestoreTable } from "drizzle-orm/singlestore -core";
681
737
682
738
const table = singlestoreTable(' table' , {
683
739
int: int().autoincrement(),
0 commit comments