Skip to content

Commit 534cb04

Browse files
committed
Merge branch 'main' of github.com:drizzle-team/drizzle-orm-docs
2 parents d064e0a + b470061 commit 534cb04

22 files changed

+152
-215
lines changed

src/components/markdown/get-started/mysql/ConnectPlanetScale.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Create a `index.ts` file in the `src/db` directory and initialize the connection
33
```typescript copy
44
import { drizzle } from "drizzle-orm/planetscale-serverless";
55

6-
const db = await drizzle({ connection: {
6+
const db = drizzle({ connection: {
77
host: process.env.DATABASE_HOST!,
88
username: process.env.DATABASE_USERNAME!,
99
password: process.env.DATABASE_PASSWORD!,

src/components/markdown/get-started/postgresql/ConnectNeon.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Create a `index.ts` file in the `src/db` directory and initialize the connection
77
```typescript
88
import { drizzle } from 'drizzle-orm/neon-http';
99

10-
const db = await drizzle("neon-http", process.env.DATABASE_URL);
10+
const db = drizzle(process.env.DATABASE_URL);
1111
```
1212

1313
If you need a synchronous connection, you can use our additional connection API,
@@ -18,5 +18,5 @@ import { neon } from '@neondatabase/serverless';
1818
import { drizzle } from 'drizzle-orm/neon-serverless';
1919

2020
const sql = neon(process.env.DATABASE_URL!);
21-
const db = drizzle(sql);
21+
const db = drizzle({ client: sql });
2222
```
Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
Create a `index.ts` file in the `src/db` directory and initialize the connection:
22

33
```typescript copy
4-
import { drizzle } from 'drizzle-orm/connect';
5-
6-
async function main() {
7-
const db = drizzle('pglite', process.env.DATABASE_URL!);
8-
}
4+
import { drizzle } from 'drizzle-orm/pglite';
95

10-
main();
6+
const db = drizzle(process.env.DATABASE_URL!);
117
```
128

13-
If you need a synchronous connection, you can use our additional connection API,
14-
where you specify a driver connection and pass it to the Drizzle instance.
9+
If you need to provide your existing driver:
1510

1611
```typescript copy
1712
import { PGlite } from '@electric-sql/pglite';
1813
import { drizzle } from 'drizzle-orm/pglite';
1914

20-
async function main() {
21-
const client = new PGlite(process.env.DATABASE_URL!);
22-
const db = drizzle(client);
23-
}
15+
const client = new PGlite(process.env.DATABASE_URL!);
16+
const db = drizzle({ client });
2417
```

src/components/markdown/get-started/postgresql/ConnectPostgreSQL.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'dotenv/config';
1414
import { drizzle } from 'drizzle-orm/node-postgres';
1515

1616
// You can specify any property from the node-postgres connection options
17-
const db = await drizzle("node-postgres", {
17+
const db = drizzle({
1818
connection: {
1919
connectionString: process.env.DATABASE_URL!,
2020
ssl: true
Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
Create a `index.ts` file in the `src/db` directory and initialize the connection:
22

33
```typescript copy
4-
import { drizzle } from 'drizzle-orm/connect';
5-
6-
async function main() {
7-
const db = await drizzle("vercel-postgres");
8-
}
4+
import { drizzle } from 'drizzle-orm/vercel-postgres';
95

10-
main();
6+
const db = drizzle();
117
```
128

13-
If you need a synchronous connection, you can use our additional connection API,
14-
where you specify a driver connection and pass it to the Drizzle instance.
9+
If you need to provide your existing driver:
1510

1611
```typescript copy
1712
import { sql } from '@vercel/postgres';
1813
import { drizzle } from 'drizzle-orm/vercel-postgres';
1914

20-
async function main() {
21-
const db = drizzle(sql)
22-
}
23-
24-
main();
15+
const db = drizzle({ client: sql })
2516
```

src/components/markdown/get-started/sqlite/ConnectBun.mdx

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,25 @@ Create a `index.ts` file in the `src` directory and initialize the connection:
55
<CodeTabs items={["libsql", "libsql with config"]}>
66
```typescript copy
77
import 'dotenv/config';
8-
import { drizzle } from 'drizzle-orm/connect';
8+
import { drizzle } from 'drizzle-orm/bun:sqlite';
99

10-
async function main() {
11-
const db = await drizzle("bun:sqlite", process.env.DB_FILE_NAME!);
12-
}
13-
14-
main();
10+
const db = drizzle(process.env.DB_FILE_NAME!);
1511
```
1612
```typescript copy
1713
import 'dotenv/config';
18-
import { drizzle } from 'drizzle-orm/connect';
19-
20-
async function main() {
21-
// You can specify any property from the libsql connection options
22-
const db = await drizzle("bun:sqlite", { connection: { source: process.env.DB_FILE_NAME! }});
23-
}
14+
import { drizzle } from 'drizzle-orm/bun:sqlite';
2415

25-
main();
16+
// You can specify any property from the libsql connection options
17+
const db = drizzle({ connection: { source: process.env.DB_FILE_NAME! }});
2618
```
2719
</CodeTabs>
2820

29-
If you need a synchronous connection, you can use our additional connection API,
30-
where you specify a driver connection and pass it to the Drizzle instance.
31-
21+
If you need to provide your existing driver:
3222
```typescript copy
3323
import 'dotenv/config';
3424
import { drizzle } from 'drizzle-orm/bun-sqlite';
3525
import { Database } from 'bun:sqlite';
3626

37-
async function main() {
38-
const sqlite = new Database(process.env.DB_FILE_NAME!);
39-
const db = drizzle(sqlite);
40-
}
41-
42-
main();
27+
const sqlite = new Database(process.env.DB_FILE_NAME!);
28+
const db = drizzle({ client: sqlite });
4329
```

src/components/markdown/get-started/sqlite/ConnectLibsql.mdx

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,29 @@ import CodeTabs from "@mdx/CodeTabs.astro";
22

33
Create a `index.ts` file in the `src` directory and initialize the connection:
44

5-
<CodeTabs items={["libsql", "libsql with config", "turso alias"]}>
5+
<CodeTabs items={["libsql", "libsql with config"]}>
66
```typescript copy
77
import 'dotenv/config';
8-
import { drizzle } from 'drizzle-orm/connect';
9-
10-
async function main() {
11-
const db = await drizzle("libsql", process.env.DB_FILE_NAME!);
12-
}
13-
14-
main();
15-
```
16-
```typescript copy
17-
import 'dotenv/config';
18-
import { drizzle } from 'drizzle-orm/connect';
19-
20-
async function main() {
21-
// You can specify any property from the libsql connection options
22-
const db = await drizzle("libsql", { connection: { url: process.env.DB_FILE_NAME! }});
23-
}
8+
import { drizzle } from 'drizzle-orm/libsql';
249

25-
main();
10+
const db = drizzle(process.env.DB_FILE_NAME!);
2611
```
2712
```typescript copy
2813
import 'dotenv/config';
29-
import { drizzle } from 'drizzle-orm/connect';
30-
31-
async function main() {
32-
// You can specify any property from the libsql connection options
33-
const db = await drizzle("turso", { connection: { url: process.env.DB_FILE_NAME! }});
34-
}
14+
import { drizzle } from 'drizzle-orm/libsql';
3515

36-
main();
16+
// You can specify any property from the libsql connection options
17+
const db = drizzle({ connection: { url: process.env.DB_FILE_NAME! }});
3718
```
3819
</CodeTabs>
3920

40-
If you need a synchronous connection, you can use our additional connection API,
41-
where you specify a driver connection and pass it to the Drizzle instance.
21+
If you need to provide your existing driver:
4222

4323
```typescript copy
4424
import 'dotenv/config';
4525
import { drizzle } from 'drizzle-orm/libsql';
4626
import { createClient } from '@libsql/client';
4727

48-
async function main() {
49-
const client = createClient({ url: process.env.DB_FILE_NAME! });
50-
const db = drizzle(client);
51-
}
52-
53-
main();
28+
const client = createClient({ url: process.env.DB_FILE_NAME! });
29+
const db = drizzle({ client });
5430
```

src/components/markdown/get-started/sqlite/QueryTurso.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ Let's **update** the `src/index.ts` file with queries to create, read, update, a
55
<CodeWithProps dialect={props.dialect} env_variable={props.env_variable}>
66
```typescript copy filename="src/index.ts"
77
import 'dotenv/config';
8-
import { drizzle, eq } from 'drizzle-orm';
8+
import { eq } from 'drizzle-orm';
9+
import { drizzle } from 'drizzle-orm/libsql';
910
import { usersTable } from './db/schema';
1011

1112
async function main() {
12-
const db = await drizzle("turso", {
13+
const db = drizzle({
1314
connection: {
1415
url: process.env.TURSO_DATABASE_URL!,
1516
authToken: process.env.TURSO_AUTH_TOKEN!

src/components/markdown/get-started/sqlite/QueryTursoUpdated.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ Let's **update** the `src/index.ts` file with queries to create, read, update, a
55
<CodeWithProps dialect={props.dialect} env_variable={props.env_variable}>
66
```typescript copy filename="src/index.ts"
77
import 'dotenv/config';
8-
import { drizzle, eq } from 'drizzle-orm';
8+
import { eq } from 'drizzle-orm';
9+
import { drizzle } from 'drizzle-orm/libsql';
910
import { usersTable } from './db/schema';
1011

1112
async function main() {
12-
const db = await drizzle("turso", {
13+
const db = drizzle({
1314
connection: {
1415
url: process.env.TURSO_DATABASE_URL!,
1516
authToken: process.env.TURSO_AUTH_TOKEN!

src/content/documentation/docs/connect-aws-data-api-pg.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ drizzle-orm @aws-sdk/client-rds-data
2222

2323
#### Step 2 - Initialize the driver and make a query
2424
```typescript copy
25-
import { drizzle } from 'drizzle-orm/connect';
25+
import { drizzle } from 'drizzle-orm/aws-data-api-pg';
2626

2727
// These three properties are required. You can also specify
2828
// any property from the RDSDataClient type inside the connection object.
29-
const db = drizzle('aws-data-api-pg', { connection: {
29+
const db = drizzle({ connection: {
3030
database: process.env['DATABASE']!,
3131
secretArn: process.env['SECRET_ARN']!,
3232
resourceArn: process.env['RESOURCE_ARN']!,
@@ -35,8 +35,7 @@ const db = drizzle('aws-data-api-pg', { connection: {
3535
await db.select().from(...);
3636
```
3737

38-
If you need a synchronous connection, you can use our additional connection API,
39-
where you specify a driver connection and pass it to the Drizzle instance.
38+
If you need to provide your existing driver:
4039

4140
```typescript copy
4241
import { drizzle } from 'drizzle-orm/aws-data-api/pg';

0 commit comments

Comments
 (0)