-
-
Notifications
You must be signed in to change notification settings - Fork 519
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
Insert many allow active models to have different column set #2433
base: master
Are you sure you want to change the base?
Conversation
I believe this should have solved the problem once and for all. Since this is changing a core part of the library, we should test it more to prevent regression. The safest way might be to have a new method |
src/query/insert.rs
Outdated
for col in columns.iter() { | ||
self.columns.push(col.is_some()); | ||
} |
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.
thanks. self.columns is really for use with add(). so should we do self.columns.clear()
first?
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.
Okay, reset (clear) it before altering it seems safer.
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.
Or simply replace the columns vector, isn't this more readable?
self.columns = columns.iter().map(Option::is_some).collect();
Fixes #1407
This requires a new feature in sea-query, Value::as_null