+
Skip to content

Conversation

billy1624
Copy link
Member

@billy1624 billy1624 self-assigned this Jun 3, 2024
@billy1624 billy1624 marked this pull request as ready for review June 3, 2024 06:34
@billy1624 billy1624 requested a review from tyt2y3 June 3, 2024 06:34
Comment on lines 321 to 328
pub fn from_insert(mut insert: Insert<A>) -> Self {
let primary_keys = <A::Entity as EntityTrait>::PrimaryKey::iter();
insert.query.on_conflict(
OnConflict::columns(primary_keys.clone())
.do_nothing_on(primary_keys)
.to_owned(),
);

Copy link
Member

@tyt2y3 tyt2y3 Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this code belongs here. on_empty_do_nothing does not mean on_conflict_do_nothing. on_empty_do_nothing simply allows us to insert empty array.

we can create a method for on_conflict_do_nothing that specifically means on PK conflict

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated! 27ce67e

@billy1624 billy1624 requested a review from tyt2y3 June 6, 2024 03:17
@billy1624 billy1624 merged commit b4506c0 into master Jun 19, 2024
@billy1624 billy1624 deleted the mysql-on-conflict-do-nothing branch June 19, 2024 12:09
Copy link

🎉 Released In 1.0.0-rc.6 🎉

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 ⭐.

Copy link

github-actions bot commented Aug 4, 2024

🎉 Released In 1.0.0 🎉

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 ⭐.

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.

On conflict do nothing for MySQL

2 participants

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