Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add relation_on_update field to DMMF model #5118

Merged
merged 1 commit into from
Jan 11, 2025

Conversation

WhyAsh5114
Copy link
Contributor

Related to: prisma/prisma#25944

@CLAassistant
Copy link

CLAassistant commented Jan 10, 2025

CLA assistant check
All committers have signed the CLA.

@WhyAsh5114 WhyAsh5114 marked this pull request as ready for review January 10, 2025 18:03
@WhyAsh5114 WhyAsh5114 requested a review from a team as a code owner January 10, 2025 18:03
@WhyAsh5114 WhyAsh5114 requested review from FGoessler and removed request for a team January 10, 2025 18:03
@WhyAsh5114
Copy link
Contributor Author

Hey! This is my first PR, and am not that experienced with Rust, so please be patient with me 😅

This is something I wanted for one of my generator projects, so I added the missing field here, and once this is merged, I can update the types in the prisma repo to include this as well.

@aqrln
Copy link
Member

aqrln commented Jan 10, 2025

For some reason the button to approve a CI run doesn't show up for me now (maybe it's because I activated the new merge experience preview feature in GitHub settings) but one thing that immediately catches my attention as something that would fail is that you need to update snapshots in tests. You need to run something like this:

UPDATE_EXPECT=1 cargo test -p dmmf -F psl/all

@WhyAsh5114
Copy link
Contributor Author

okay, will try it, for some reason cargo test isn't working properly in WSL, I might need to try it natively.

I will try it for a bit, if it doesn't work in WSL, I'll get back to this tomorrow (need to install Linux)

@aqrln
Copy link
Member

aqrln commented Jan 10, 2025

I don't think WSL or bare-metal installation of Linux should make any difference. What's the exact problem you're facing, is there any specific error?

@WhyAsh5114
Copy link
Contributor Author

I ran out of storage 😭. Fixing it rn!

@WhyAsh5114
Copy link
Contributor Author

Compiling query-engine-node-api v0.1.0 (/home/anonjr/Programming/prisma-engines/query-engine/query-engine-node-api)
error: linking with `cc` failed: exit status: 1

big path
= note: /usr/bin/ld: /home/anonjr/Programming/prisma-engines/target/debug/deps/libdriver_adapters-f3bf520a3a1ff790.rlib(driver_adapters-f3bf520a3a1ff790.ev09v6p8e3dhtg1xjgjmcwvkc.rcgu.o): in function `driver_adapters::types::__register__enum__ColumnType_callback__':
          /home/anonjr/Programming/prisma-engines/query-engine/driver-adapters/src/types.rs:144:(.text._ZN15driver_adapters5types39__register__enum__ColumnType_callback__17hacc5c8f25d96e65cE+0x8d): undefined reference to `napi_create_object'
          /usr/bin/ld: /home/anonjr/Programming/prisma-engines/query-engine/driver-adapters/src/types.rs:144:(.text._ZN15driver_adapters5types39__register__enum__ColumnType_callback__17hacc5c8f25d96e65cE+0x2ae): undefined reference to `napi_set_named_property'
          /usr/bin/ld: /home/anonjr/Programming/prisma-engines/query-engine/driver-adapters/src/types.rs:144:(.text._ZN15driver_adapters5types39__register__enum__ColumnType_callback__17hacc5c8f25d96e65cE+0x518): undefined reference to `napi_set_named_property'
          /usr/bin/ld: /home/anonjr/Programming/prisma-engines/query-engine/driver-adapters/src/types.rs:144:(.text._ZN15driver_adapters5types39__register__enum__ColumnType_callback__17hacc5c8f25d96e65cE+0x782): undefined reference to `napi_set_named_property'
          /usr/bin/ld: /home/anonjr/Programming/prisma-engines/query-engine/driver-adapters/src/types.rs:144:(.text._ZN15driver_adapters5types39__register__enum__ColumnType_callback__17hacc5c8f25d96e65cE+0x9ec): undefined reference to `napi_set_named_property'
          /usr/bin/ld: /home/anonjr/Programming/prisma-engines/query-engine/driver-adapters/src/types.rs:144:(.text._ZN15driver_adapters5types39__register__enum__ColumnType_callback__17hacc5c8f25d96e65cE+0xc56): undefined reference to `napi_set_named_property'
          /usr/bin/ld: /home/anonjr/Programming/prisma-engines/target/debug/deps/libdriver_adapters-f3bf520a3a1ff790.rlib(driver_adapters-f3bf520a3a1ff790.ev09v6p8e3dhtg1xjgjmcwvkc.rcgu.o):/home/anonjr/Programming/prisma-engines/query-engine/driver-adapters/src/types.rs:144: more undefined references to `napi_set_named_property' follow
          /usr/bin/ld: /home/anonjr/Programming/prisma-engines/target/debug/deps/libnapi-485db2fba3273acf.rlib(napi-485db2fba3273acf.napi.ee2df9165f82ad68-cgu.05.rcgu.o): in function `napi::bindgen_runtime::js_values::number::<impl napi::bindgen_runtime::js_values::ToNapiValue for i32>::to_napi_value':
          /home/anonjr/.cargo/registry/src/index.crates.io-6f17d22bba15001f/napi-2.16.13/src/bindgen_runtime/js_values/number.rs:25:(.text._ZN4napi15bindgen_runtime9js_values6number79_$LT$impl$u20$napi..bindgen_runtime..js_values..ToNapiValue$u20$for$u20$i32$GT$13to_napi_value17h526f850d7166bafcE+0x73): undefined reference to `napi_create_int32'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

error: could not compile `query-engine-node-api` (lib test) due to 1 previous error

@aqrln
Copy link
Member

aqrln commented Jan 11, 2025

@WhyAsh5114 this error looks like you tried to run cargo test for all crates in the workspace which won't work for query-engine-node-api because it links to the Node.js N-API symbols. You only need to run the tests for dmmf and maybe prisma-fmt crates for this PR.

@aqrln
Copy link
Member

aqrln commented Jan 11, 2025

try the command I suggested above

@WhyAsh5114
Copy link
Contributor Author

Yeah, that one works

    Blocking waiting for file lock on build directory
   Compiling psl-core v0.1.0 (/home/anonjr/Documents/prisma-engines/psl/psl-core)
   Compiling psl v0.1.0 (/home/anonjr/Documents/prisma-engines/psl/psl)
   Compiling query-structure v0.0.0 (/home/anonjr/Documents/prisma-engines/query-engine/query-structure)
   Compiling schema v0.1.0 (/home/anonjr/Documents/prisma-engines/query-engine/schema)
   Compiling dmmf v0.1.0 (/home/anonjr/Documents/prisma-engines/query-engine/dmmf)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 1m 05s
     Running unittests src/lib.rs (target/debug/deps/dmmf-8d5db86b83d905bf)

running 9 tests
test tests::tests::mongo_docs ... ok
test tests::tests::views_ignore ... ok
test tests::tests::sqlite_ignore ... ok
test tests::tests::unsupported_in_composite_type ... ok
test tests::tests::unusupported_in_compound_id_must_not_panic ... ok
test tests::tests::enum_docs ... ok
test tests::tests::unusupported_in_compound_unique_must_not_panic ... ok
test ast_builders::datamodel_ast_builder::tests::test_dmmf_rendering ... ok
test tests::tests::dmmf_rendering ... ok

test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 19.45s

   Doc-tests dmmf

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Copy link
Member

@aqrln aqrln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link

codspeed-hq bot commented Jan 11, 2025

CodSpeed Performance Report

Merging #5118 will not alter performance

Comparing WhyAsh5114:on-update-metadata (f794e04) with main (66ff515)

Summary

✅ 11 untouched benchmarks

@aqrln aqrln merged commit c571c6d into prisma:main Jan 11, 2025
342 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants