Skip to content

Commit a71e8cb

Browse files
committed
docs(vi): Update Vietnamese for Drizzle Usage, Prisma Usage and Typescript Usage pages
1 parent e650dcf commit a71e8cb

File tree

3 files changed

+57
-57
lines changed

3 files changed

+57
-57
lines changed

www/src/pages/vi/usage/drizzle.mdx

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
title: Drizzle
3-
description: Usage of Drizzle
3+
description: Cách sử dụng Drizzle
44
layout: ../../../layouts/docs.astro
55
lang: vi
66
isMdx: true
77
---
88

9-
Drizzle is a headless Typescript ORM with [relational](https://orm.drizzle.team/docs/rqb) and [SQL-like](https://orm.drizzle.team/docs/select) query APIs. It can handle database migrations and schemas, and provides a type safe database client. It also comes with [Drizzle-Kit](https://orm.drizzle.team/drizzle-studio/overview), a set of companion tools that help with querying your database.
9+
Drizzle là một Headless Typescript ORM với [các truy vấn kiểu quan hệ](https://orm.drizzle.team/docs/rqb) [các truy vấn kiểu SQL](https://orm.drizzle.team/docs/select). Nó có thể xử lý các cập nhật cơ sở dữ liệu và các mô hình, và đồng thời cung cấp một client nơi kiểu dữ liệu có mối liên hệ chặt chẽ với cơ sở dữ liệu. Mặt khác, Drizzle cũng cho ra mắt [Drizzle-Kit](https://orm.drizzle.team/drizzle-studio/overview), một bộ công cụ không thể thiếu nhằm giúp bạn làm việc với cơ sở dữ liệu của bạn.
1010

1111
## Drizzle Client
1212

13-
The Drizzle Client is located at `src/server/db/index.ts`. In this file, you can define your database connection url and connect your schema to the database object.
13+
Drizzle Client được định nghĩa ở `src/server/db/index.ts`. Trong tệp này, bạn có thể định nghĩa URL kết nối cơ sở dữ liệu của bạn và kết nối schema của bạn với cơ sở dữ liệu.
1414

1515
```ts:src/server/db/index.ts
1616
import { env } from "~/env";
@@ -23,7 +23,7 @@ const conn = postgres(env.DATABASE_URL)
2323
export const db = drizzle(conn, { schema });
2424
```
2525

26-
We reccommend including the database client in your tRPC Context:
26+
Chúng tôi khuyên bạn nên bao gồm client của Drizzle trong context của tRPC:
2727

2828
```ts:src/server/api/trpc.ts
2929
import { db } from "~/server/db";
@@ -41,13 +41,13 @@ export const createTRPCContext = async (opts: { headers: Headers }) => {
4141

4242
## Schema
4343

44-
The Drizzle schema file can be found at `src/server/db/schema.ts`. This file is where you can define your database schema and models, and connects to the Drizzle Client.
44+
Schema của Drizzle có thể được tìm thấy ở `src/server/db/schema.ts`. Đây là nơi bạn có thể định nghĩa schema của cơ sở dữ liệu và các mô hình của bạn, và kết nối chúng với Drizzle Client.
4545

46-
When you select NextAuth.js in combination with Drizzle, the schema file is generated and set up for you with the recommended values for the `User`, `Session`, `Account`, and `VerificationToken` models, as per the [Auth.js documentation](https://authjs.dev/getting-started/adapters/drizzle).
46+
Khi bạn chọn sử dụng NextAuth.js kết hợp với Drizzle, tệp schema được tạo và thiết lập cho bạn với các giá trị được Auth.js khuyến nghị như là `User`, `Session`, `Account`, `VerificationToken`, tìm hiểu thêm tại [tài liệu Auth.js](https://authjs.dev/getting-started/adapters/drizzle).
4747

4848
## Drizzle Kit
4949

50-
Drizzle Kit is a collection of command line tools designed to help you manage your database. T3 Stack automatically includes drizzle kit when you select Drizzle as your ORM.
50+
Drizzle Kit là một bộ công cụ dòng lệnh (CLI) được thiết kế giúp bạn quản lý cơ sở dữ liệu của bạn. T3 Stack tự động bao gồm Drizzle Kit khi bạn chọn Drizzle làm ORM của mình.
5151

5252
```json:package.json
5353
"scripts": {
@@ -60,25 +60,25 @@ Drizzle Kit is a collection of command line tools designed to help you manage yo
6060
},
6161
```
6262

63-
### Script Explanations
63+
### Giải thích các lệnh
6464

6565
`db:generate`
66-
Generates TypeScript types and models from your database schema, ensuring type safety and easy integration with Drizzle ORM.
66+
Tạo ra các kiểu TypeScript và mô hình từ schema của cơ sở dữ liệu của bạn, đảm bảo tính toàn vẹn của kiểu dữ liệu và dễ dàng tích hợp với Drizzle ORM.
6767

6868
`db:migrate`
69-
Applies pending migrations to your database, keeping your schema in sync with changes and updates in your project.
69+
Áp dụng các cập nhật chưa được áp dụng cho cơ sở dữ liệu của bạn, giữ cho schema của bạn đồng bộ với các thay đổi và cập nhật trong dự án của bạn.
7070

7171
`db:push`
72-
Pushes local schema changes directly to the database without needing explicit migration files. This can be useful for quick syncing in development.
72+
Đẩy các thay đổi schema cục bộ trực tiếp đến cơ sở dữ liệu mà không cần các tệp cập nhật chuyển đổi. Điều này có thể hữu ích cho việc đồng bộ hóa nhanh chóng trong quá trình phát triển.
7373

7474
`db:studio`
75-
Opens a visual interface for managing and inspecting your database tables, data, and relationships.
75+
Mở một giao diện trực quan để quản lý và kiểm tra các bảng, dữ liệu và mối quan hệ của cơ sở dữ liệu của bạn.
7676

77-
## Useful Resources
77+
## Tài liệu hữu ích
7878

79-
| Resource | Link |
80-
| --------------------------- | --------------------------------------------------- |
81-
| Drizzle Docs | https://orm.drizzle.team/docs/overview |
82-
| Drizzle GitHub | https://github.com/drizzle-team/drizzle-orm |
83-
| Auth.JS Drizzle Adapter | https://authjs.dev/getting-started/adapters/drizzle |
84-
| Drizzle Kit Migration Guide | https://orm.drizzle.team/docs/kit-overview |
79+
| Tài liệu | Đường dẫn |
80+
| ------------------------------------- | --------------------------------------------------- |
81+
| Tài liệu của Drizzle | https://orm.drizzle.team/docs/overview |
82+
| GitHub của Drizzle | https://github.com/drizzle-team/drizzle-orm |
83+
| Adapter Drizzle của Auth.JS | https://authjs.dev/getting-started/adapters/drizzle |
84+
| Hướng dẫn migrate sử dụng Drizzle Kit | https://orm.drizzle.team/docs/kit-overview |

www/src/pages/vi/usage/prisma.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
22
title: Prisma
3-
description: Usage of Prisma
3+
description: Cách sử dụng Prisma
44
layout: ../../../layouts/docs.astro
55
lang: vi
66
---
77

8-
Prisma is an ORM for TypeScript, that allows you to define your database schema and models in a `schema.prisma` file, and then generate a type-safe client that can be used to interact with your database from your backend.
8+
Prisma là một ORM cho TypeScript, cho phép bạn định nghĩa schema và mô hình của cơ sở dữ liệu của bạn trong tệp `schema.prisma`, và sau đó tạo ra một client mà kiểu dữ liệu của bạn sẽ được liên kết chặt chẽ với cơ sở dữ liệu của bạn và có thể được sử dụng để tương tác với cơ sở dữ liệu của bạn từ backend.
99

1010
## Prisma Client
1111

12-
Located at `src/server/db.ts`, the Prisma Client is instantiated as a global variable (as recommended as [best practice](https://www.prisma.io/docs/guides/database/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices#problem) by the team at Prisma) and exported to be used in your API routes. We include the Prisma Client in [Context](/en/usage/trpc#-serverapitrpcts) by default and recommend using this instead of importing it separately in each file.
12+
Client của Prisma được đặt ở `src/server/db.ts`, được khởi tạo như là một biến toàn cục (được khuyến nghị là [best practice](https://www.prisma.io/docs/guides/database/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices#problem) bởi đội ngũ tại Prisma) và được xuất ra để được sử dụng trong các route API của bạn. Chúng tôi đã bao gồm Prisma Client trong [Context](/en/usage/trpc#-serverapitrpcts) và khuyến nghị bạn sử dụng từ Context thay vì nhập nó riêng lẻ trong từng tệp.
1313

1414
## Schema
1515

16-
You will find the Prisma schema file at `/prisma/schema.prisma`. This file is where you define your database schema and models, and is used when generating the Prisma Client.
16+
Bạn sẽ tìm thấy tệp schema của Prisma ở `/prisma/schema.prisma`. Đây là nơi bạn định nghĩa schema và mô hình của cơ sở dữ liệu của bạn, và được sử dụng khi tạo ra client của Prisma.
1717

18-
### With NextAuth.js
18+
### Với NextAuth.js
1919

20-
When you select NextAuth.js in combination with Prisma, the schema file is generated and set up for you with the recommended values for the `User`, `Session`, `Account`, and `VerificationToken` models, as per the [NextAuth.js documentation](https://next-auth.js.org/adapters/prisma).
20+
Khi bạn chọn NextAuth.js kết hợp với Prisma, tệp schema được tạo và thiết lập cho bạn với các giá trị được Auth.js khuyến nghị như là `User`, `Session`, `Account`, `VerificationToken`, tìm hiểu thêm tại [tài liệu Auth.js](https://next-auth.js.org/adapters/prisma).
2121

22-
## Default Database
22+
## Cơ sở dữ liệu mặc định
2323

24-
The default database is an SQLite database, which is great for development and quickly spinning up a proof-of-concept but is not recommended for production. You can change the database to use by changing the `provider` in the `datasource` block to either `postgresql` or `mysql`, and then updating the connection string within environment variables to point to your database.
24+
Cơ sở dữ liệu mặc định là cơ sở dữ liệu SQLite, tuy đây là điều tốt để bạn có thể tập trung cho phát triển và tạo ra một proof-of-concept nhanh chóng, nhưng chúng tôi không khuyến nghị bạn làm điều này cho production cảu bạn. Bạn có thể thay đổi cơ sở dữ liệu để sử dụng bằng cách thay đổi `provider` trong khối `datasource` thành `postgresql` hoặc `mysql`, và sau đó cập nhật chuỗi kết nối trong biến môi trường để Prisma có thể kết nối với cơ sở dữ liệu của bạn.
2525

26-
## Seeding your Database
26+
## Tạo dữ liệu cho cơ sở dữ liệu
2727

28-
[Seeding your database](https://www.prisma.io/docs/guides/database/seed-database) is a great way to quickly populate your database with test data to help you get started. In order to setup seeding, you will need to create a `seed.ts` file in the `/prisma` directory, and then add a `seed` script to your `package.json` file. You'll also need a TypeScript runner that can execute the seed-script. We recommend [tsx](https://github.com/esbuild-kit/tsx), which is a very performant TypeScript runner that uses esbuild and doesn't require any ESM configuration, but `ts-node` or other runners will work as well.
28+
[Tạo dữ liệu cho cơ sở dữ liệu](https://www.prisma.io/docs/guides/database/seed-database) là một cách tốt để nhanh chóng điền đầy cơ sở dữ liệu với dữ liệu thử nghiệm để giúp bạn bắt đầu. Để thiết lập seeding, bạn sẽ cần tạo một tệp `seed.ts` trong thư mục `/prisma`, và sau đó thêm một script `seed` vào tệp `package.json` của bạn. Bạn cũng sẽ cần thêm vào một Typescript runner để thực thi script seed, chúng tôi đề xuất [tsx](https://github.com/esbuild-kit/tsx), một Typescript runner rất hiệu quả sử dụng esbuild và không yêu cầu bất kỳ cấu hình ESM, nhưng `ts-node` hoặc các runner khác cũng sẽ hoạt động tốt cho bước này.
2929

3030
```jsonc:package.json
3131
{
@@ -65,14 +65,14 @@ main()
6565
});
6666
```
6767

68-
Then, just run `pnpm db-seed` (or `npm`/`yarn`) to seed your database.
68+
Sau đó, chỉ cần chạy `pnpm db-seed` (hoặc `npm`/`yarn`) để tạo dữ liệu cho cơ sở dữ liệu của bạn.
6969

70-
## Useful Resources
70+
## Tài liệu hữu ích
7171

72-
| Resource | Link |
73-
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
74-
| Prisma Docs | https://www.prisma.io/docs/ |
75-
| Prisma GitHub | https://github.com/prisma/prisma |
76-
| Prisma Migrate Playground | https://playground.prisma.io/guides |
77-
| NextAuth.JS Prisma Adapter | https://next-auth.js.org/adapters/prisma |
78-
| PlanetScale Connection Guide | https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-typescript-planetscale |
72+
| Tài liệu | Đường dẫn |
73+
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
74+
| Tài liệu của Prisma | https://www.prisma.io/docs/ |
75+
| GitHub của Prisma | https://github.com/prisma/prisma |
76+
| Khu thử nghiệm Prisma Migrate | https://playground.prisma.io/guides |
77+
| Prisma Adapter cho NextAuth.JS | https://next-auth.js.org/adapters/prisma |
78+
| Hướng dẫn kết nối cơ sở dữ liệu PlanetScale | https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-typescript-planetscale |

0 commit comments

Comments
 (0)