Skip to content

Commit

Permalink
Merge pull request #444 from medz/fix/flutter-tx
Browse files Browse the repository at this point in the history
Fix not commit TX
  • Loading branch information
medz authored Nov 2, 2024
2 parents 499732b + 5c79913 commit 0c04035
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 54 deletions.
Binary file modified bun.lockb
Binary file not shown.
12 changes: 6 additions & 6 deletions examples/flutter_with_orm/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3"
channel: "stable"
revision: "2e2c358c9b14765c90343af9df11e12c5dfc3e6c"
channel: "beta"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
create_revision: 2e2c358c9b14765c90343af9df11e12c5dfc3e6c
base_revision: 2e2c358c9b14765c90343af9df11e12c5dfc3e6c
- platform: android
create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
create_revision: 2e2c358c9b14765c90343af9df11e12c5dfc3e6c
base_revision: 2e2c358c9b14765c90343af9df11e12c5dfc3e6c

# User provided section

Expand Down
2 changes: 1 addition & 1 deletion examples/flutter_with_orm/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gradle-wrapper.jar
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
32 changes: 9 additions & 23 deletions examples/flutter_with_orm/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,8 @@ plugins {
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}

android {
namespace = "dev.odroe.flutter_with_orm"
namespace = "dev.odroe.prisma_flutter_example"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

Expand All @@ -33,15 +15,19 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "dev.odroe.flutter_with_orm"
applicationId = "dev.odroe.prisma_flutter_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
versionCode = flutter.versionCode
versionName = flutter.versionName
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="flutter_with_orm"
android:label="prisma_flutter_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion examples/flutter_with_orm/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
4 changes: 2 additions & 2 deletions examples/flutter_with_orm/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"
6 changes: 5 additions & 1 deletion examples/flutter_with_orm/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ class _HomeState extends State<Home> {
}

void onDelete(int id) async {
prisma.user.delete(where: UserWhereUniqueInput(id: id)).then((_) {
prisma.$transaction((tx) async {
final res = await tx.user.delete(where: UserWhereUniqueInput(id: id));
print('TX delete user:');
print(res?.toJson());
}).then((_) {
setState(() {
users.removeWhere((u) => u.id == id);
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"dependencies": {
"prisma": "^5.19.1",
"prisma": "^5.21.1",
"vitepress": "^1.3.4"
},
"scripts": {
Expand Down
24 changes: 24 additions & 0 deletions packages/orm_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## v0.3.1

To install Prisma Flutter Integration v0.3.1 run this command

```bash
dart pub add orm_flutter:^0.3.1
```

Or update your `pubspec.yaml` file:

```yaml
dependencies:
orm_flutter: ^0.3.1
```
### What's New
- **bug**: Fixed an issue where a transaction was not committed, Thx @Joschiller REF [#443](https://github.com/medz/prisma-dart/issues/443)
- **upstream**: Upgrade CABI engine to `bf0e5e8a04cada8225617067eaa03d041e2bba36` (v5.21.1)

### Notes

After upgrading the `orm_flutter` version, please run the `flutter clean` command.

## v0.3.0

### What's Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libquery_engine.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>libquery_engine.a</string>
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>libquery_engine.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/orm_flutter/lib/src/library_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class LibraryEngine extends Engine implements Finalizable {
required Transaction transaction}) async {
final Pointer<Char> trace =
headers.traceparent?.toNativeUtf8().cast() ?? nullptr;
final response = _bindingsInstance.rollbackTransaction(
final response = _bindingsInstance.commitTransaction(
_qe, transaction.id.toNativeUtf8().cast(), trace);
if (response == nullptr) {
throw StateError('Prisma engine did not commit transaction.');
Expand Down
2 changes: 1 addition & 1 deletion packages/orm_flutter/prisma-engines-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a6977e518975c6a4e6ae77bf7faf8afc08b97e7d
bf0e5e8a04cada8225617067eaa03d041e2bba36
4 changes: 2 additions & 2 deletions packages/orm_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: orm_flutter
description: "The engine of Prisma ORM for Flutter, Library for binding Prisma's C-Abi engine with Flutter."
version: 0.3.0
version: 0.3.1
resolution: workspace
homepage: https://prisma.pub/getting-started/flutter.html
repository: https://github.com/medz/prisma-dart
Expand All @@ -27,7 +27,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
ffigen: ^14.0.0
ffigen: ^15.0.0

flutter:
plugin:
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ packages:
dependency: transitive
description:
name: ffigen
sha256: "585a852fefda1b796322b45b433e602daae58f92dd8d918b2497db02f1cabf7c"
sha256: a0ca4853028c6a9e4d9a0a40bb744fceb898c89d75931d08e87b3987d0087060
url: "https://pub.dev"
source: hosted
version: "14.0.1"
version: "15.0.0"
file:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: workspace
name: _
publish_to: none

environment:
Expand Down

0 comments on commit 0c04035

Please sign in to comment.