-
-
Notifications
You must be signed in to change notification settings - Fork 38
doc: v3.3 incremental updates #566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,6 +58,24 @@ export const db = new ZenStackClient(schema, { | |||||||||
| ``` | ||||||||||
| </TabItem> | ||||||||||
|
|
||||||||||
| <TabItem value="mysql" label={`MySQL`}> | ||||||||||
|
|
||||||||||
| <PackageInstall dependencies={["mysql2"]} /> | ||||||||||
|
|
||||||||||
| ```ts title='db.ts' | ||||||||||
| import { ZenStackClient } from '@zenstackhq/orm'; | ||||||||||
| import { MysqlDialect } from '@zenstackhq/orm/dialects/mysql'; | ||||||||||
| import { schema } from './zenstack/schema'; | ||||||||||
| import { createPool } from 'mysql2'; | ||||||||||
|
|
||||||||||
| export const db = new ZenStackClient(schema, { | ||||||||||
| dialect: new MysqlDialect({ | ||||||||||
| pool: createPool(process.env.DATABASE_URL), | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
✏️ Suggested fix- pool: createPool(process.env.DATABASE_URL),
+ pool: createPool(process.env.DATABASE_URL!),or more defensively: - pool: createPool(process.env.DATABASE_URL),
+ pool: createPool(process.env.DATABASE_URL as string),📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| }), | ||||||||||
| }); | ||||||||||
| ``` | ||||||||||
| </TabItem> | ||||||||||
|
|
||||||||||
| </Tabs> | ||||||||||
|
|
||||||||||
| The created `db` object has the full ORM API inferred from the type of the `schema` parameter. When necessary, you can also explicitly get the inferred client type like: | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.