You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: www/src/pages/vi/usage/drizzle.mdx
+19-19
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
2
title: Drizzle
3
-
description: Usage of Drizzle
3
+
description: Cách sử dụng Drizzle
4
4
layout: ../../../layouts/docs.astro
5
5
lang: vi
6
6
isMdx: true
7
7
---
8
8
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)và [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.
10
10
11
11
## Drizzle Client
12
12
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.
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.
45
45
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`, và`VerificationToken`, tìm hiểu thêm tại [tài liệu Auth.js](https://authjs.dev/getting-started/adapters/drizzle).
47
47
48
48
## Drizzle Kit
49
49
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.
51
51
52
52
```json:package.json
53
53
"scripts": {
@@ -60,25 +60,25 @@ Drizzle Kit is a collection of command line tools designed to help you manage yo
60
60
},
61
61
```
62
62
63
-
### Script Explanations
63
+
### Giải thích các lệnh
64
64
65
65
`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.
67
67
68
68
`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.
70
70
71
71
`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.
73
73
74
74
`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.
Copy file name to clipboardExpand all lines: www/src/pages/vi/usage/prisma.md
+19-19
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,31 @@
1
1
---
2
2
title: Prisma
3
-
description: Usage of Prisma
3
+
description: Cách sử dụng Prisma
4
4
layout: ../../../layouts/docs.astro
5
5
lang: vi
6
6
---
7
7
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.
9
9
10
10
## Prisma Client
11
11
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.
13
13
14
14
## Schema
15
15
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.
17
17
18
-
### With NextAuth.js
18
+
### Với NextAuth.js
19
19
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`, và`VerificationToken`, tìm hiểu thêm tại [tài liệu Auth.js](https://next-auth.js.org/adapters/prisma).
21
21
22
-
## Default Database
22
+
## Cơ sở dữ liệu mặc định
23
23
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.
25
25
26
-
## Seeding your Database
26
+
## Tạo dữ liệu cho cơ sở dữ liệu
27
27
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.
29
29
30
30
```jsonc:package.json
31
31
{
@@ -65,14 +65,14 @@ main()
65
65
});
66
66
```
67
67
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.
|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