Skip to content

Noop when update without providing any values - #1384

Merged
tyt2y3 merged 8 commits into
masterfrom
update-with-noop
Jan 26, 2023
Merged

tyt2y3 merged 8 commits into
masterfrom
update-with-noop

Conversation

@billy1624

@billy1624 billy1624 commented Jan 10, 2023 •

Copy link
Copy Markdown
Member

PR Info

Bug Fixes

  • When updating / saving an existing ActiveModel with all its value being Unchanged or NotSet, the expected behaviour should be no-op. That's to skip firing any update statement.

@billy1624
billy1624 marked this pull request as ready for review January 12, 2023 09:20
@billy1624
billy1624 requested a review from tyt2y3 January 12, 2023 09:36
Comment thread Cargo.toml Resolved
@billy1624
billy1624 requested a review from tyt2y3 January 26, 2023 08:27
@tyt2y3
tyt2y3 merged commit 036edf9 into master Jan 26, 2023
@tyt2y3
tyt2y3 deleted the update-with-noop branch January 26, 2023 09:12
vec![
Transaction::from_sql_and_values(
DbBackend::Postgres,
r#"UPDATE "fruit" SET WHERE "fruit"."id" = $1 RETURNING "id", "name", "cake_id""#,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Didn't know we put such a test case here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep. That's bad :(

@billy1624 billy1624 Jan 26, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's a red flag that sit there silently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Syntax Error when saving active model that sets nothing

2 participants