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(psl): add deprecation warning for the "referentialIntegrity" attribute #3449
feat(psl): add deprecation warning for the "referentialIntegrity" attribute #3449
Conversation
#[test] | ||
fn relation_mode_and_referential_integrity_cannot_cooccur() { | ||
let schema = indoc! {r#" | ||
datasource ps { | ||
provider = "sqlite" | ||
url = "sqlite" | ||
relationMode = "prisma" | ||
referentialIntegrity = "foreignKeys" | ||
} | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
"#}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to relation_mode_and_referential_integrity_cannot_cooccur.prisma
in the validation_tests
suite
(Some((_span, rm)), None) | (None, Some((_span, rm))) => { | ||
let integrity = match coerce::string(rm, diagnostics)? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the code down here to the new get_and_validate_relation_mode_value
and validate_allowed_relation_mode_settings
closures, as they're used both when only the relationMode
attribute is used or when only the referentialIntegrity
attribute is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are mixing concerns and making the code more complicated here. Would something much simpler like if args.contains("referentialIntegrity") { ... push the warning here ... }
at the beginning of the function, before the match
works. It would emit two warnings in case you defined both, but that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on warning message
… when it co-occurs with the "relationMode" attribute
The
referentialIntegrity
attribute to set theforeignKeys
|prisma
settings is deprecated in favor ofrelationMode
as of #3428.This PR adds a validation warning when
referentialIntegrity
appears as adatasource
attribute in a Prisma schema:"""
The
referentialIntegrity
attribute is deprecated. Please userelationMode
instead. Learn more at https://pris.ly/d/relation-mode"""
Closes prisma/prisma#15689.