Skip to content

Commit 1b3b699

Browse files
committed
update mysql connect docs
1 parent ebd83eb commit 1b3b699

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

src/content/documentation/docs/connect-planetscale.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ drizzle-orm @planetscale/database
3333

3434
#### Step 2 - Initialize the driver and make a query
3535
```typescript copy"
36-
import { drizzle } from "drizzle-orm/connect";
36+
import { drizzle } from "drizzle-orm/planetscale-serverless";
3737

38-
const db = await drizzle('planetscale', { connection: {
38+
const db = drizzle({ connection: {
3939
host: process.env["DATABASE_HOST"],
4040
username: process.env["DATABASE_USERNAME"],
4141
password: process.env["DATABASE_PASSWORD"],
@@ -44,8 +44,7 @@ const db = await drizzle('planetscale', { connection: {
4444
const response = await db.select().from(...)
4545
```
4646

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

5049
```typescript copy"
5150
import { drizzle } from "drizzle-orm/planetscale-serverless";
@@ -57,7 +56,7 @@ const client = new Client({
5756
password: process.env["DATABASE_PASSWORD"],
5857
});
5958

60-
const db = drizzle(client);
59+
const db = drizzle({ client });
6160
```
6261

6362
Make sure to checkout the PlanetScale official **[MySQL courses](https://planetscale.com/courses/mysql-for-developers/introduction/course-introduction)**,

src/content/documentation/docs/connect-tidb.mdx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,20 @@ drizzle-orm @tidbcloud/serverless
3333

3434
#### Step 2 - Initialize the driver and make a query
3535
```typescript copy filename="index.ts"
36-
import { drizzle } from 'drizzle-orm/connect';
36+
import { drizzle } from 'drizzle-orm/tidb-serverless';
3737

38-
const db = await drizzle('tidb-serverless', { connection: { url: process.env.TIDB_URL }});
38+
const db = await drizzle({ connection: { url: process.env.TIDB_URL }});
3939

4040
const response = await db.select().from(...)
4141
```
4242

43-
If you need a synchronous connection, you can use our additional connection API,
44-
where you specify a driver connection and pass it to the Drizzle instance.
45-
43+
If you need to provide your existing driver:
4644
```typescript copy"
4745
import { connect } from '@tidbcloud/serverless';
4846
import { drizzle } from 'drizzle-orm/tidb-serverless';
4947

50-
const client = connect({ url: '...' });
51-
const db = drizzle(client);
48+
const client = connect({ url: process.env.TIDB_URL });
49+
const db = drizzle({ client });
5250
```
5351

5452
#### What's next?

src/content/documentation/docs/get-started-mysql.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,23 @@ drizzle-orm mysql2
2222
#### Step 2 - Initialize the driver and make a query
2323
<CodeTabs items={['mysql2', 'mysql with config']}>
2424
```typescript copy
25-
import { drizzle } from "drizzle-orm/connect";
25+
import { drizzle } from "drizzle-orm/mysql2";
2626

27-
const db = await drizzle("mysql2", process.env.DATABASE_URL);
27+
const db = drizzle(process.env.DATABASE_URL);
2828

2929
const response = await db.select().from(...)
3030
```
3131
```typescript copy
32-
import { drizzle } from "drizzle-orm/connect";
32+
import { drizzle } from "drizzle-orm/mysql2";
3333

3434
// You can specify any property from the mysql2 connection options
35-
const db = await drizzle("mysql2", { connection:{ uri: process.env.DATABASE_URL }});
35+
const db = drizzle({ connection:{ uri: process.env.DATABASE_URL }});
3636

3737
const response = await db.select().from(...)
3838
```
3939
</CodeTabs>
4040

41-
If you need a synchronous connection, you can use our additional connection API, where you specify a driver connection and pass it to the Drizzle instance.
42-
There're two ways you can connect to the MySQL with `mysql2` driver, either single `client` connection or a `pool`.
41+
If you need to provide your existing driver:
4342

4443
<CodeTabs items={['Client connection', 'Pool connection']}>
4544
```typescript copy
@@ -53,7 +52,7 @@ There're two ways you can connect to the MySQL with `mysql2` driver, either sing
5352
...
5453
});
5554

56-
const db = drizzle(connection);
55+
const db = drizzle({ client: connection });
5756
```
5857
```typescript copy
5958
import { drizzle } from "drizzle-orm/mysql2";
@@ -66,7 +65,7 @@ There're two ways you can connect to the MySQL with `mysql2` driver, either sing
6665
...
6766
});
6867

69-
const db = drizzle(poolConnection);
68+
const db = drizzle({ client: poolConnection });
7069
```
7170
</CodeTabs>
7271

0 commit comments

Comments
 (0)