+
Skip to content

Conversation

tyt2y3
Copy link
Member

@tyt2y3 tyt2y3 commented Dec 1, 2024

Fixes #1407

This requires a new feature in sea-query, Value::as_null

@tyt2y3
Copy link
Member Author

tyt2y3 commented Dec 1, 2024

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 insert_many_nopanic, but of course ideally we should replace the old method transparently.

Comment on lines 195 to 197
for col in columns.iter() {
self.columns.push(col.is_some());
}
Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member

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();

@tyt2y3 tyt2y3 merged commit 7dffaf1 into master Dec 23, 2024
36 checks passed
@tyt2y3 tyt2y3 deleted the insert-no-panic branch December 23, 2024 23:12
Copy link

🎉 Released In 1.1.3 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

@tyt2y3 tyt2y3 mentioned this pull request Dec 24, 2024
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.

Panic in insert_many if ActiveModels have different columns set

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载