-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #391 from medz/v5-dev
Prisma ORM for Dart v5
- Loading branch information
Showing
46 changed files
with
1,508 additions
and
1,162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "pub" | ||
directory: "/packages/orm" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "pub" | ||
directory: "/packages/orm_flutter" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Prisma Dart v5.0.0 & Flutter integration 0.1.0 | ||
|
||
To install Prisma ORM for Dart v5.0.0 run this command: | ||
|
||
```bash | ||
dart pub add orm:^5.0.0 | ||
``` | ||
|
||
or update your `pubspec.yaml` file: | ||
|
||
```yaml | ||
dependencies: | ||
orm: ^5.0.0 | ||
``` | ||
--- | ||
FLutter integration: | ||
```yaml | ||
dependencies: | ||
orm_flutter: ^0.1.0 | ||
``` | ||
[**"Prisma Dart v4 -> v5 & Flutter integration" Upgrade Guides**](https://prisma.pub/getting-started/upgrade_guides.html) | ||
## What's Changed | ||
* refactor: throws prisma client errors | ||
* refactor(engine): Refactoring binary engines | ||
* refactor(client): add base client and client options | ||
* feat(client): add `env` support | ||
* feat(client): add logging | ||
* refactor(Flutter integration): Refactoring the Flutter integration engine. | ||
|
||
**Full Changelog**: https://github.com/medz/prisma-dart/compare/orm-v4.4.0...orm-v5.0.0+orm_flutter-v0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Upgrade Guides | ||
|
||
## Prisma Dart v4 -> v5 & Flutter integration | ||
|
||
Upgrading from Prisma Dart v4 to v5 is relatively simple. Although it is a major version change, there are no changes to user APIs. | ||
|
||
### `engineType` in Prisma schema | ||
|
||
Now, in the Flutter integration, you tell the generator that you want to generate a client for Flutter: | ||
|
||
```prisma | ||
generator client { | ||
provider = "dart run orm" | ||
output = "../lib/_generated_prisma_client" | ||
engineType = "flutter" // [!code focus] | ||
} | ||
``` | ||
|
||
### `PrismaClient` | ||
|
||
Major changes to Prisma Client: | ||
|
||
1. Changed from an isolated type to a self-dependent type with `Class PrismaClient extends BasePrismaClient<PrismaClient>`. | ||
2. Deprecated `PrismaClient.use` method. | ||
|
||
Before: | ||
|
||
```dart | ||
final prisma = PrismaClient.use((schema, datasoruce) { | ||
/// Your codes, create engine and returns. | ||
}); | ||
``` | ||
|
||
Now: | ||
|
||
```dart | ||
final engine = ...; // You created engine instandce. | ||
final prisma = PrismaClient(engine: engine); | ||
``` | ||
|
||
### Logging | ||
|
||
Previously, we relied on the `logging` package for logging. Then you needed to listen for the logs and output them yourself. | ||
|
||
Now, Prisma Dart implements the same logging as the Prisma TS/JS client. | ||
|
||
For more logging information, see 👉 [Prisma Logging](https://www.prisma.io/docs/orm/prisma-client/observability-and-logging/logging). | ||
|
||
#### Output to console | ||
|
||
Before: | ||
|
||
```dart | ||
import 'package:loging/loging.dart'; | ||
Logger.root.onRecore.listen((log) { | ||
print(log.message); | ||
}); | ||
``` | ||
|
||
Now: | ||
|
||
```dart | ||
final prisma = PrismaClient( | ||
log: { | ||
(LogLevel.query, LogEmit.stdout), | ||
// ... More level configs | ||
}, | ||
); | ||
``` | ||
|
||
#### Log event | ||
|
||
Before: | ||
|
||
```dart | ||
import 'package:loging/loging.dart'; | ||
Logger.root.onRecore.listen((log) { | ||
//... You custon. | ||
}); | ||
``` | ||
|
||
Now: | ||
|
||
```dart | ||
final prisma = PrismaClient( | ||
log: { | ||
(LogLevel.query, LogEmit.event), | ||
// ... More level configs | ||
}, | ||
); | ||
prisma.$on(LogLevel.query, (event) { | ||
// ... | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.