-
Notifications
You must be signed in to change notification settings - Fork 238
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
Exclude constraints are PG only, lighten up the api #3887
Exclude constraints are PG only, lighten up the api #3887
Conversation
1311064
to
214d031
Compare
CodSpeed Performance ReportMerging #3887 Summary
|
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.
nice, cleaner
…stgres (#3860) * feat(schema-engine): add constraints_query.sql for postgres * feat(schema-engine): add check and exclusion constraints stopgap support for postgres * feat(schema-engine): add skeleton for stopgap warnings for check and exclusion constraints in postgres * feat(schema-engine): emit warnings when finding check and exclusion constraints when introspecting postgres * chore: remove comments * chore: remove dbg * test(schema-engine): add missing defaults in describer tests * chore: update warning messages so that they make more sense * feat(schema-engine): updated check and exclusion constraints warning messages * test(schema-engine): validate introspected schemas for check and exclusion constraints * feat(schema-engine): introspecting models with check or exclusion constraints now adds a comment to such models * feat(schema-engine): fix edge case of model having both check and exclusion constraints * feat(schema-engine): fix prisma/prisma#17515 * chore: remove dead code * chore: fix conflicts * fix: avoid duplicated model commments upon reintrospection * feat(schema-engine): use ModelAndConstraint rather than CheckConstraint and ExclusionConstraint * feat(schema-engine): replace IndexMap with BTreeMap for leaner flag "upsert" capabilities * chore: add TODO to answer Tom's review comment * Exclude constraints are PG only, lighten up the api (#3887) * Exclude constraints are PG only, lighten up the api * Split constraint tests into its own file * Fix describer tests * feat(schema-engine): apply review comments --------- Co-authored-by: Julius de Bruijn <julius+github@nauk.io>
/// The check constraint names for the table. | ||
pub fn check_constraints(self) -> impl ExactSizeIterator<Item = &'a str> { | ||
let low = self.schema.check_constraints.partition_point(|(id, _)| *id < self.id); | ||
let high = self.schema.check_constraints[low..].partition_point(|(id, _)| *id <= self.id); | ||
|
||
self.schema.check_constraints[low..high] | ||
.iter() | ||
.map(|(_, name)| name.as_str()) |
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.
Note: this has caused dramatic issues in introspection-ci
.
What we do here: