docs: minor improvements

This commit is contained in:
Bereket Engida
2024-09-28 13:58:00 +03:00
parent 71913c49f6
commit c5ebe36bb0
3 changed files with 10 additions and 5 deletions

View File

@@ -201,7 +201,10 @@ export default function Features() {
Start now Start now
</Button> </Button>
</Link> </Link>
<Link href="/docs" className="z-50"> <Link
href="https://github.com/better-auth/better-auth"
className="z-50"
>
<Button <Button
className="mt-4 rounded-none p-5 ml-auto gap-2" className="mt-4 rounded-none p-5 ml-auto gap-2"
variant="outline" variant="outline"

View File

@@ -258,7 +258,7 @@ if(error){
} }
``` ```
If the functions accepte a `fetchOptions` object, you can pass an `onError` function to handle errors. If the actions accepts a `fetchOptions` option, you can pass `onError` callback to handle errors.
```ts title="client.ts" ```ts title="client.ts"

View File

@@ -3,9 +3,11 @@ title: Database
description: Learn how to use a database with BetterAuth description: Learn how to use a database with BetterAuth
--- ---
Better auth requires a database connection to store data. Better auth comes with a built in database mangment using <Link href="https://kysely.dev/"> Kysley </Link> to manage the database. The database will be used to store data such as users, sessions, and more. Plugins can also define their own database tables to store data. Better auth requires a database connection to store data. It comes with a query builder called <Link href="https://kysely.dev/"> Kysley </Link> to manage and query your database. The database will be used to store data such as users, sessions, and more. Plugins can also define their own database tables to store data.
You can pass a database connection to better auth by passing a `database` object to the `betterAuth` function. The `database` object should have a `provider` key that specifies the database provider to use. By default, better auth support `postgres`, `mysql` and `sqlite`. You can also pass a kysley dialect directly to use other databases supported by kysley. The `database` object can also have a `url` key that specifies the database connection to use. If you're using `sqlite`, you can pass a file path in the `url` key. You can pass a database connection to better auth by passing a `database` object auth options. The `database` object takes `provider` key that specifies the database provider to use. By default, better auth support `postgres`, `mysql` and `sqlite` and a `url` key that specifies the database connection to use. If you're using `sqlite`, you can pass a file path in the `url` key.
You can also pass a kysley dialect directly to use other databases supported by kysley.
**Example: Sqlite** **Example: Sqlite**
```ts title="auth.ts" ```ts title="auth.ts"
@@ -60,7 +62,7 @@ See <Link href="https://kysely.dev/docs/dialects" target="_blank"> Kysley Dialec
## Running Migrations ## Running Migrations
Better auth includes a CLI tool to manage database migrations. Use the `migrate` command to create or update tables as needed. Better auth comes with a CLI tool to manage database migrations. Use the `migrate` command to create or update tables as needed.
The cli checks your database and prompts you to add missing tables or update existing ones with new columns. The cli checks your database and prompts you to add missing tables or update existing ones with new columns.