prisma-dart

Prisma Client Dart is an auto-generated type-safe ORM. It uses Prisma Engine as the data access layer and is as consistent as possible with the Prisma Client JS/TS APIs.

BSD-3-CLAUSE License

Stars
418
Committers
21

Bot releases are hidden (Show)

prisma-dart - Prisma Client Dart v3.4.7

Published by medz 9 months ago

To install Prisma Dart client v3.4.7, run the following command:

dart pub add orm:3.4.7

To update Prisma Dart client v3.4.7, update the orm dependency in your pubspec.yaml file.

dependencies:
  orm: ^3.4.7

What's Changed

  1. Bug: Permission issues that may be caused by using absolute paths are resolved to paths based on pwd.
prisma-dart - Prisma Client Dart v4.0.0-beta.1

Published by medz 9 months ago

To install Prisma Client Dart v4.0.0-beta.1 run:

dart pub add orm:4.0.0-beta.1

Or update your pubspec.yaml file:

dependencies:
  orm: 4.0.0-beta.1

What's Changed

Thanks

@kidusdev

prisma-dart - Prisma Client Dart v4.0.0-beta

Published by medz 9 months ago

To install Prisma Client Dart v4.0.0-beta run:

dart pub add orm:4.0.0-beta

Or update your pubspec.yaml file:

dependencies:
  orm: 4.0.0-beta

What's Changed

The first Beta version is released. This version is a major version. We will conduct a lot of testing on this version to ensure the stability of this version.
In addition, there are no actual code updates in this version, the documentation brings updates to the API Reference:

  1. Client API Reference
  2. Model Delegate API Reference
prisma-dart - Prisma Dart client v4.0.0-alpha.5

Published by medz 9 months ago

To install Prisma Dart client v4.0.0-alpha.5 run:

dart pub add orm:4.0.0-alpha.5

Or update your pubspec.yaml file:

dependencies:
  orm: 4.0.0-alpha.5

What's Changed

  1. FIX fix transaction isolation level not expected.
prisma-dart - Prisma Dart client v4.0.0-alpha.4

Published by medz 9 months ago

To install Prisma Dart client v4.0.0-alpha.4 run:

dart pub add orm:4.0.0-alpha.4

Or update your pubspec.yaml file:

dependencies:
  orm: 4.0.0-alpha.4

What's Changed

  1. OPTIMIZATION Prisma Dart client generator outputs more user-friendly error messages that help you know where the problem lies.
  2. REFACTOR Adjust src code storage structure.
  3. FIX Rethrow start error
  4. FIX Fix input types required multiple fields.
  5. FIX Fix relation count not arguments in include.
prisma-dart - Prisma Dart client v4.0.0-alpha.3

Published by medz 9 months ago

To install Prisma Dart client v4.0.0-alpha.3 run:

dart pub add orm:4.0.0-alpha.3

Or update your pubspec.yaml file:

dependencies:
  orm: 4.0.0-alpha.3

What's Changed

  1. Dump webfetch to 0.0.14 version.
  2. Fixed using a model name with an underscore (_) in schema.prisma causing the generator to fail. - #317 #316
prisma-dart - Prisma Dart client v4.0.0-alpha.2

Published by medz 10 months ago

To install Prisma Dart client v4.0.0-alpha.2 run:

dart pub add orm:4.0.0-alpha.2

Or update your pubspec.yaml file:

dependencies:
  orm: 4.0.0-alpha.2

What's Changed

  1. Change Dart SDK version to ^3.2.0
  2. Support RAW query and execute feature, See Raw queries

Raw queries

You can use $raw to execute raw queries

$raw.query

Execute a raw query, for example:

final result = await prisma.$raw.query('SELECT * FROM "User"'); // PostgreSQL

$raw.execute

Execute a raw query, for example:

final result = await prisma.$raw.execute('DELETE FROM "User"'); // PostgreSQL

Parameters

$raw.query and $raw.execute support parameters, for example:

// PostgreSQL
final result = await prisma.$raw.query(
  'SELECT * FROM "User" WHERE "id" = \$1',
  [1],
);

// MySQL
final result = await prisma.$raw.query(
  'SELECT * FROM `User` WHERE `id` = ?',
  [1],
);

SQL template string see your used database.

prisma-dart - Prisma Dart client v3.4.6

Published by medz 10 months ago

To install Prisma Dart client v3.4.6, run the following command:

dart pub add orm

To update Prisma Dart client v3.4.6, update the orm dependency in your pubspec.yaml file.

dependencies:
  orm: ^3.4.6

What's Changed

  1. The binary engine will be copied to the current working command and named prisma-query-engine
  2. Add the .dart_tool directory to the search directory

About not found prisma-query-engine error

Cannot find the query engine binary (Basename: C:\path\does\not\matter\query-engine-windows.exe | prisma-query-engine)

If you just run your app using the dart run {script}.dart command, you don’t need to do anything.

If you use dart compile exe to package your app as a executable, copy prisma-query-engine to the same location as your run file

prisma-dart - Prisma Dart client v4.0.0-alpha.1

Published by medz 10 months ago

To install Prisma Dart client v4.0.0-alpha.1 run:

dart pub add orm:4.0.0-alpha.1

Or update your pubspec.yaml file:

dependencies:
  orm: 4.0.0-alpha.1

What's Changed

  1. Refactor the entire client generator
  2. PrismaClient is now generated by the generator
  3. Ability to operate transactions on your own
  4. Use binary engine by default
  5. Supports full select and include features.
prisma-dart - Prisma Dart client v3.4.5

Published by medz 11 months ago

To install Prisma Dart client v3.4.5, run the following command:

dart pub add orm

To update Prisma Dart client v3.4.5, update the orm dependency in your pubspec.yaml file.

dependencies:
  orm: ^3.4.5

What's Changed

  1. Bug: fix not working on Prisma 5.
  2. Bug: type 'Null' is not a subtype of type 'bool' in type cast. #273 #259
  3. Feature: Now, Copy current platform engine to output directory. #285
prisma-dart - Prisma Dart client v4.0.0-alpha.0

Published by medz 11 months ago

To install Prisma Dart client v4.0.0-alpha.0 run:

# If you are using Dart
dart pub add orm:4.0.0-alpha.0

# Or if you are using Flutter
flutter pub add orm:4.0.0-alpha.0

To upgrade to Prisma Dart client v4.0.0-alpha.0, Please follow the announcements and update your pubspec.yaml file:

dependencies:
  orm: 4.0.0-alpha.0

Read Prisma Dart Client v4.0.0-alpha.0 release notes on the Prisma Dart discussions

What's Changed

  • Whole project refactoring
  • Remove any JSON serialization tool, now it's ready to use by just generating the client without any other dependencies and extra commands
  • Switch from GraphQL protocol to JSON protocol
  • Client takes a standalone Prisma engine instance
  • Client and all input/output types are standalone and can be distributed to any Dart platform
  • Add database field reference support
  • Support select feature (incomplete, currently only support rough one-level Model fields)
  • Support include feature (incomplete, currently only support rough one-level Model fields)
  • PrismaUnion regression, now can structure nested inputs of multiple parameters via union
  • PrismaNull regression, now support database null data setting
  • DMMF, generator helpers regression, no need to depend on other packages, can directly use orm as the base package for developing Dart Prisma ecosystem packages
  • Add Decimal type support (from decimal package, exported by orm proxy)
prisma-dart -

Published by medz over 1 year ago

prisma-dart -

Published by medz over 1 year ago

BREAKING CHANGE

  • Update Dart SDK to ^3.0.0
  • Generator: Adapt to upstream dependencies
prisma-dart - v3.0.0

Published by medz over 1 year ago

🌟 Help us spread the word about Prisma ORM for Dart by starring the repo or tweeting about the release. 🌟

Note: Migration from 2.x to 3.x guide is available here.

prisma-dart -

Published by medz over 1 year ago

No change log

prisma-dart -

Published by medz over 1 year ago

prisma-dart - πŸŽ‰ release: v2.6.2

Published by medz almost 2 years ago

  1. Fixed DateTime to String must be ISO8601 format error - #103
  2. Fixed PrismaNull being serialized as null error.
prisma-dart - πŸŽ‰ release: v2.6.1

Published by medz almost 2 years ago

  1. Fixed generated freezed file has undefined class error - #96
  2. generated Prisma Dart Client is now null-safe
  3. Optimize the log parameter for createPrismaClient
prisma-dart - πŸŽ‰ release: v2.6.0

Published by medz almost 2 years ago

🌟 Help us spread the word about Prisma ORM for Dart by starring the repo or tweeting about the release. 🌟

New requirements

Breaking change: You are now asked to install the freezed package:

dart pub add freezed -d

Breaking changes

All input classes types will be reset!

The Map input by forJson needs to follow the freezed rules, examples:

final PrismaNull $null = PrismaNull.fromJson({}); // An empty map must be entered to indicate PrismaNull

final UserWhereInput where = UserWhereInput.fromJson({
  'id': {
    'runtimeType': 'withInt', // The runtimeType must be entered, name is `UserWhereInput_id` factory name.
    'value': 1,
  },
});

PrismaUnion has been removed:

Before:

final data = UserCreateInput(
  name: PrismaUnion.zero("Seven"),
);

Now:

final data = CreateOneUserData.withUserCreateInput( // OR `withUserUncheckedCreateInput`
  UserCreateInput(
    name: "Seven",
  ),
);

Note: withUserCreateInput and withUserUncheckedCreateInput are generated by prisma_client.dart file.

Model delegates

All delegat methods input classes are now generated by freezed package, Example(create a user):

Before:

final user = await prisma.user.create(
  data: UserCreateInput(
    name: PrismaUnion.zero("Seven"),
  ),
);

Now:

final user = await prisma.user.create(
  data: CreateOneUserData.withUserUncheckedCreateInput(
    UserUncheckedCreateInput(
      name: 'Seven',
      email: '[email protected]',
    ),
  ),
);

Seems like it's getting troublesome?

We are preparing to support more Prisma functions in the future, such as REF query.

In addition, we are preparing for the next Dart 3, and we expect that in Dart 3, there is no need to run additional commands before compilation to complete the serialization of input and output types.

Since full input types are relatively cumbersome for web applications, we recommend using the fromJson method to create inputs.

Because the current input is the complete Prisma input type, it is expected to be improved in Dart 3. Currently, Dart 2 does not support union types. Our strategy is to create as many types as possible to meet all Prisma input requirements.

prisma-dart - πŸŽ‰ release: v2.5.1

Published by medz almost 2 years ago

Support OrThrow methods

Prisma client now supports OrThrow methods.

final User user = await prisma.user.findUniqueOrThrow(...);
final Post post = await prisma.post.findFirstOrThrow(...);