Skip to content

Commit d5ec821

Browse files
committed
updates
1 parent 4fd1902 commit d5ec821

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

versioned_docs/version-3.x/migrate-prisma.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: How to migrate from a Prisma project to ZenStack v3
3-
sidebar_position: 11
3+
sidebar_position: 10
44
---
55

66
import PackageInstall from './_components/PackageInstall';

versioned_docs/version-3.x/migrate-v2.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: How to migrate from a ZenStack v2 project to v3
3-
sidebar_position: 10
3+
sidebar_position: 11
44
---
55

66
import PackageInstall from './_components/PackageInstall';
@@ -9,40 +9,40 @@ import PackageInstall from './_components/PackageInstall';
99

1010
## Overview
1111

12-
ZenStack v3 is a major rewrite of v2, with a focus on simplicity and flexibility. It replaced Prisma ORM with its own ORM component built above [Kysely](https://kysely.dev/), resulting in a much more light-weighted architecture and the level extensibility that we couldn't achieve in v2.
12+
ZenStack v3 is a major rewrite of v2, with a focus on simplicity and flexibility. It replaced Prisma ORM with its own ORM component built on top of [Kysely](https://kysely.dev/), resulting in a much more lighter-weight architecture and the level of extensibility that we couldn't achieve in v2.
1313

1414
A few v3 design decisions should make an upgrade much less painful:
1515

16-
- The ZModel schema is essentially compatible with v2.
17-
- The ORM query API compatible with that of `PrismaClient`, thus compatible with v2.
16+
- The ZModel schema is compatible with v2.
17+
- The ORM query API is compatible with that of `PrismaClient`, thus compatible with v2.
1818

1919
However, given the architectural changes, some effort is required to adapt to the new system. This guide will help you migrate an existing ZenStack v2 project.
2020

2121
## Compatibility Check
2222

23-
Here are a few important items to verify before preparing your migration:
23+
Here are a few essential items to verify before preparing your migration:
2424

2525
- Database support
2626

27-
V3 only supports PostgreSQL and SQLite databases for now. MySQL will be added later.
27+
V3 currently only supports PostgreSQL and SQLite databases. MySQL will be added later.
2828

29-
For PostgreSQL, only native the traditional TCP-based connection is supported. Newer HTTP-based protocols like supported by newer providers like Neon and Prisma PG are not supported yet, but will be in the future.
29+
For PostgreSQL, only native the traditional TCP-based connection is supported. Newer HTTP-based protocols, such as those supported by providers like Neon and Prisma PG, are not yet supported, but will be in the future.
3030

3131
- Prisma feature gaps
3232

3333
A few Prisma ORM's features are not implemented or not planned. Please check the [Prisma Feature Gaps](./migrate-prisma.md#feature-gaps) for details.
3434

3535
- V2 feature gaps
3636

37-
A few ZenStack v2's features are not implemented. Some less popular features are planned to be dropped. Please check the [Feature Gaps](#feature-gaps) for details.
37+
A few ZenStack v2 features are not implemented. Some less popular features are planned to be removed. Please check the [Feature Gaps](#feature-gaps) for details.
3838

3939
## Migrating Prisma
4040

41-
Since ZenStack v3 is not based on Prisma ORM anymore, the first thing to do is to replace Prisma dependencies with ZenStack and update code where `PrismaClient` is created. Please follow the [Prisma Migration Guide](./migrate-prisma.md) for detailed instructions.
41+
Since ZenStack v3 is no longer based on Prisma ORM, the first step is to replace Prisma dependencies with ZenStack and update the code where `PrismaClient` is created. Please follow the [Prisma Migration Guide](./migrate-prisma.md) for detailed instructions.
4242

4343
## Migrating Access Policies
4444

45-
Since v3's ZModel language is backward compatible with v2, no much work is needed in ZModel files. One change necessary is that, if you use access policies (`@@allow`, `@@deny`, etc.), they are now in self-contained plugins, and you need to install the package separately, add a plugin declaration in ZModel, and install the plugin at runtime.
45+
Since v3's ZModel language is backward compatible with v2, not much work is required in ZModel files. One necessary change is that, if you use access policies (`@@allow`, `@@deny`, etc.), they are now declared in self-contained plugins. You need to install the package separately, add a plugin declaration in ZModel, and then install the plugin at runtime.
4646

4747
1. Install the package
4848

@@ -86,7 +86,7 @@ async function processRequest(request: Request) {
8686
}
8787
```
8888

89-
The policy rules in ZModel are mostly backward compatible, except for a breaking change about post-update policies. In v3, post-update rules are expressed with its own "post-update" policy type and separate from regular "update" rules. Inside "post-update" rules, by default fields refer to the entity's "after-update" state, and you can use the `before()` function to refer to the "before-update" state. See [Post Update Rules](./orm/access-control/post-update.md) for more details.
89+
The policy rules in ZModel are mostly backward compatible, except for a breaking change about post-update policies. In v3, post-update rules are expressed with their own "post-update" policy type and separate from regular "update" rules. Inside "post-update" rules, by default, fields refer to the entity's "after-update" state, and you can use the `before()` function to refer to the "before-update" state. See [Post Update Rules](./orm/access-control/post-update.md) for more details.
9090

9191
Here's a quick example for how to migrate:
9292

@@ -144,9 +144,9 @@ function getClientForRequest(request: Request) {
144144

145145
## Migrating Client-Side Hooks
146146

147-
V3 brings a new implementation of [TanStack Query](https://tanstack.com/query) implementation that doesn't require code generation. Instead, TS types are fully inferred from the schema type at compile time, and the runtime logic is based on interpretation of the schema object. As a result, the new integration becomes a simple library that you call, and no plugin is involved.
147+
V3 introduces a new implementation of [TanStack Query](https://tanstack.com/query) implementation that doesn't require code generation. Instead, TS types are fully inferred from the schema type at compile time, and the runtime logic is based on the interpretation of the schema object. As a result, the new integration becomes a simple library that you call, and no plugin is involved.
148148

149-
To support such an architecture change. Query hooks are now grouped into an object that mirrors the API style of the ORM client. You need to adjust v2 code (that uses the flat `useFindMany[Model]` style hooks) into this new structure.
149+
To support such an architecture change. Query hooks are now grouped into an object that mirrors the API style of the ORM client. You need to adjust the v2 code (that uses the flat `useFindMany[Model]` style hooks) into this new structure.
150150

151151
V2:
152152
```ts
@@ -174,37 +174,41 @@ export function MyComponent() {
174174

175175
## Migration Custom Plugins
176176

177-
V3 comes with a completely revised plugin system that offers great power and flexibility. You can check the concepts in the [Data Model Plugin](./modeling/plugin.md) and [ORM Plugin](./orm/plugins/) documentation.
177+
V3 comes with a completely revised plugin system that offers greater power and flexibility. You can check the concepts in the [Data Model Plugin](./modeling/plugin.md) and [ORM Plugin](./orm/plugins/) documentation.
178178

179179
The plugin development document is still WIP. This part of the migration guide will be added later when it's ready.
180180

181181
## Feature Gaps
182182

183-
This section lists v2 features that haven't been migrated to v3 yet, or that are planned to be removed in v3. Please feel free to share your thoughts about these decisions in [Discord](https://discord.gg/Ykhr738dUe) and we'll be happy to discuss them.
183+
This section lists v2 features that haven't been migrated to v3 yet, or that are planned to be removed in v3. Please feel free to share your thoughts about these decisions in [Discord](https://discord.gg/Ykhr738dUe), and we'll be happy to discuss them.
184184

185185
### Automatic password hashing
186186

187187
The `@password` attribute is removed in v3. We believe most people will use a more sophisticated authentication system than a simple id/password mechanism.
188188

189189
### Field-level access control
190190

191-
Not supported yet but will be added soon with some design changes.
191+
Not supported yet, but will be added soon with some design changes.
192+
193+
### Data encryption
194+
195+
Not supported yet, but will be added soon.
192196

193197
### Zod integration
194198

195-
Not supported yet but will be added soon with some design changes.
199+
Not supported yet, but will be added soon with some design changes.
196200

197201
### Checking permissions without querying the database
198202

199203
The [check()](/docs/guides/check-permission) feature is removed due to low popularity.
200204

201205
### tRPC integration
202206

203-
[TRPC](https://trpc.io/) is TypeScript inference heavy, and stacking it over ZenStack generates additional complexities and pressure to the compiler. We're evaluating the best way to integrate it in v3, and no concrete plan is in place yet. At least there's no plan to directly migrate the code-generation based approach in v2.
207+
[TRPC](https://trpc.io/) is TypeScript-inference heavy, and stacking it over ZenStack generates additional complexities and pressure on the compiler. We're evaluating the best way to integrate it in v3, and no concrete plan is in place yet. At least there's no plan to migrate the code-generation-based approach in v2 directly.
204208

205209
### OpenAPI spec generation
206210

207-
The [OpenAPI plugin](/docs/reference/plugins/openapi) is not migrated to v3 yet and will be added later with some redesign.
211+
The [OpenAPI plugin](/docs/reference/plugins/openapi) has not migrated to v3 yet and will be added later with some redesign.
208212

209213
### SWR integration
210214

@@ -214,4 +218,4 @@ The [SWR plugin](https://swr.vercel.app/) is removed due to low popularity.
214218

215219
### Is data migration needed?
216220

217-
No. From database schema point of view, v3 is fully backward compatible with v2.
221+
No. From the database schema point of view, v3 is fully backward-compatible with v2.

versioned_docs/version-3.x/roadmap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 11
2+
sidebar_position: 12
33
---
44

55
# Roadmap

0 commit comments

Comments
 (0)