-
Notifications
You must be signed in to change notification settings - Fork 110
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
core: Sort constraint definitions before comparing #727
Conversation
When updating a database, we may falsely report schemas as not compatible due to the `ConstraintDef`s coming out in different orders in the proposed and existing schemas. Not sorting them was an oversight in 9bb2b21.
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.
@kim I am going to stamp this but won't pretend to understand the difference :) May I steal some of your time soon to get a walk-through of the code that gives some context? I've been meaning to ask you, anyways :)
.filter(|c| c.constraints != Constraints::unset()) | ||
.collect() | ||
} | ||
|
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.
Could be better to do this change inside TableDef
?:
pub struct TableDef {
pub table_name: String,
pub constraints: BtreeSet<ConstraintDef>,
}
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.
Do we actually want to store them like that? We might just want this function as a way to compare them. I think I'm going to propose that we merge this and consider that for future work.
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.
It threw me off a bit to realize that there can be unset constraints in the table def, so we would still need an element-wise comparison if it was a set already.
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.
This LGTM
.filter(|c| c.constraints != Constraints::unset()) | ||
.collect() | ||
} | ||
|
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.
Do we actually want to store them like that? We might just want this function as a way to compare them. I think I'm going to propose that we merge this and consider that for future work.
When updating a database, we may falsely report schemas as not
compatible due to the
ConstraintDef
s coming out in different orders inthe proposed and existing schemas.
Not sorting them was an oversight in 9bb2b21.
Expected complexity level and risk
1