@prisma-next/extension-paradedb 0.3.0-dev.134 → 0.3.0-dev.146

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +22 -16
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -33,24 +33,29 @@ pnpm add @prisma-next/extension-paradedb
33
33
  Define BM25 indexes on your tables using `bm25` field builders plus `bm25Index()`:
34
34
 
35
35
  ```typescript
36
- import { defineContract } from '@prisma-next/sql-contract-ts/contract-builder';
37
36
  import { int4Column, textColumn, jsonbColumn } from '@prisma-next/adapter-postgres/column-types';
37
+ import sqlFamily from '@prisma-next/family-sql/pack';
38
+ import { defineContract, field, model } from '@prisma-next/sql-contract-ts/contract-builder';
38
39
  import { bm25, bm25Index } from '@prisma-next/extension-paradedb/index-types';
39
40
  import paradedb from '@prisma-next/extension-paradedb/pack';
40
41
  import postgres from '@prisma-next/target-postgres/pack';
41
42
 
42
- export const contract = defineContract()
43
- .target(postgres)
44
- .extensionPacks({ paradedb })
45
- .table('items', (t) =>
46
- t
47
- .column('id', { type: int4Column, nullable: false })
48
- .column('description', { type: textColumn, nullable: false })
49
- .column('category', { type: textColumn, nullable: false })
50
- .column('rating', { type: int4Column, nullable: false })
51
- .column('metadata', { type: jsonbColumn, nullable: false })
52
- .primaryKey(['id'])
53
- .index(
43
+ export const contract = defineContract({
44
+ family: sqlFamily,
45
+ target: postgres,
46
+ extensionPacks: { paradedb },
47
+ models: {
48
+ Item: model('Item', {
49
+ fields: {
50
+ id: field.column(int4Column).id(),
51
+ description: field.column(textColumn),
52
+ category: field.column(textColumn),
53
+ rating: field.column(int4Column),
54
+ metadata: field.column(jsonbColumn),
55
+ },
56
+ }).sql({
57
+ table: 'items',
58
+ indexes: [
54
59
  bm25Index({
55
60
  keyField: 'id',
56
61
  fields: [
@@ -61,9 +66,10 @@ export const contract = defineContract()
61
66
  ],
62
67
  name: 'search_idx',
63
68
  }),
64
- ),
65
- )
66
- .build();
69
+ ],
70
+ }),
71
+ },
72
+ });
67
73
  ```
68
74
 
69
75
  ### Field Builders
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@prisma-next/extension-paradedb",
3
- "version": "0.3.0-dev.134",
3
+ "version": "0.3.0-dev.146",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "dependencies": {
7
- "@prisma-next/contract": "0.3.0-dev.134",
8
- "@prisma-next/contract-authoring": "0.3.0-dev.134"
7
+ "@prisma-next/contract": "0.3.0-dev.146",
8
+ "@prisma-next/contract-authoring": "0.3.0-dev.146"
9
9
  },
10
10
  "devDependencies": {
11
11
  "tsdown": "0.18.4",