prisma-sql 1.1.0 → 1.2.0
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.
- package/package.json +1 -1
- package/readme.md +12 -12
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# prisma-sql
|
|
2
2
|
|
|
3
3
|
Speed up Prisma reads **2-7x** by executing queries via postgres.js instead of Prisma's query engine.
|
|
4
4
|
|
|
@@ -28,13 +28,13 @@ This extension bypasses the engine for read queries and executes raw SQL directl
|
|
|
28
28
|
**PostgreSQL:**
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
npm install
|
|
31
|
+
npm install prisma-sql postgres
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
**SQLite:**
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
npm install
|
|
37
|
+
npm install prisma-sql better-sqlite3
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Quick Start
|
|
@@ -43,7 +43,7 @@ npm install @dee-wan/prisma-sql better-sqlite3
|
|
|
43
43
|
|
|
44
44
|
```typescript
|
|
45
45
|
import { PrismaClient } from '@prisma/client'
|
|
46
|
-
import { speedExtension } from '
|
|
46
|
+
import { speedExtension } from 'prisma-sql'
|
|
47
47
|
import postgres from 'postgres'
|
|
48
48
|
|
|
49
49
|
const sql = postgres(process.env.DATABASE_URL)
|
|
@@ -60,7 +60,7 @@ const users = await prisma.user.findMany({
|
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
62
|
import { PrismaClient } from '@prisma/client'
|
|
63
|
-
import { speedExtension } from '
|
|
63
|
+
import { speedExtension } from 'prisma-sql'
|
|
64
64
|
import Database from 'better-sqlite3'
|
|
65
65
|
|
|
66
66
|
const db = new Database('./data.db')
|
|
@@ -75,7 +75,7 @@ In some environments (Cloudflare Workers, Vercel Edge, bundlers), Prisma's DMMF
|
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
77
|
import { PrismaClient, Prisma } from '@prisma/client'
|
|
78
|
-
import { speedExtension } from '
|
|
78
|
+
import { speedExtension } from 'prisma-sql'
|
|
79
79
|
import postgres from 'postgres'
|
|
80
80
|
|
|
81
81
|
const sql = postgres(process.env.DATABASE_URL)
|
|
@@ -433,7 +433,7 @@ const slow = await prisma.$original.user.findMany()
|
|
|
433
433
|
|
|
434
434
|
```typescript
|
|
435
435
|
import { PrismaClient, Prisma } from '@prisma/client'
|
|
436
|
-
import { speedExtension } from '
|
|
436
|
+
import { speedExtension } from 'prisma-sql'
|
|
437
437
|
import postgres from 'postgres'
|
|
438
438
|
|
|
439
439
|
const sql = postgres(process.env.DATABASE_URL)
|
|
@@ -457,7 +457,7 @@ export default async function handler(req: Request) {
|
|
|
457
457
|
For Cloudflare Workers, use the standalone SQL generation API instead of the extension:
|
|
458
458
|
|
|
459
459
|
```typescript
|
|
460
|
-
import { createToSQL } from '
|
|
460
|
+
import { createToSQL } from 'prisma-sql'
|
|
461
461
|
import { Prisma } from '@prisma/client'
|
|
462
462
|
|
|
463
463
|
const toSQL = createToSQL(Prisma.dmmf, 'sqlite')
|
|
@@ -654,7 +654,7 @@ const users = await prisma.user.findMany()
|
|
|
654
654
|
|
|
655
655
|
```typescript
|
|
656
656
|
import postgres from 'postgres'
|
|
657
|
-
import { speedExtension } from '
|
|
657
|
+
import { speedExtension } from 'prisma-sql'
|
|
658
658
|
|
|
659
659
|
const sql = postgres(DATABASE_URL)
|
|
660
660
|
const prisma = new PrismaClient().$extends(speedExtension({ postgres: sql }))
|
|
@@ -682,7 +682,7 @@ const users = await db
|
|
|
682
682
|
**After:**
|
|
683
683
|
|
|
684
684
|
```typescript
|
|
685
|
-
import { speedExtension } from '
|
|
685
|
+
import { speedExtension } from 'prisma-sql'
|
|
686
686
|
|
|
687
687
|
const sql = postgres(DATABASE_URL)
|
|
688
688
|
const prisma = new PrismaClient().$extends(speedExtension({ postgres: sql }))
|
|
@@ -875,7 +875,7 @@ npm test
|
|
|
875
875
|
Benchmark your own queries:
|
|
876
876
|
|
|
877
877
|
```typescript
|
|
878
|
-
import { speedExtension } from '
|
|
878
|
+
import { speedExtension } from 'prisma-sql'
|
|
879
879
|
|
|
880
880
|
const queries: { name: string; duration: number }[] = []
|
|
881
881
|
|
|
@@ -985,7 +985,7 @@ MIT
|
|
|
985
985
|
|
|
986
986
|
## Links
|
|
987
987
|
|
|
988
|
-
- [NPM Package](https://www.npmjs.com/package
|
|
988
|
+
- [NPM Package](https://www.npmjs.com/package/prisma-sql)
|
|
989
989
|
- [GitHub Repository](https://github.com/dee-see/prisma-sql)
|
|
990
990
|
- [Issue Tracker](https://github.com/dee-see/prisma-sql/issues)
|
|
991
991
|
|