Skip to content
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

Fix bulk_update when using a pk other than id #1689

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Conversation

abvf
Copy link
Contributor

@abvf abvf commented Aug 1, 2024

In method bulk_update, the primary key name is hard-coded as "id"; therefore, it throws an error when using a primary key with a name other than id.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@coveralls
Copy link

coveralls commented Aug 4, 2024

Pull Request Test Coverage Report for Build 10239333398

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 89.09%

Totals Coverage Status
Change from base Build 10196201661: 0.0%
Covered Lines: 5960
Relevant Lines: 6575

💛 - Coveralls

@abondar
Copy link
Member

abondar commented Aug 4, 2024

Hi!

Thanks for your submission
Could you please add some kind of test that reproduces issue?
You can write it somewhere here https://github.com/tortoise/tortoise-orm/blob/develop/tests/test_update.py#L37

@abvf
Copy link
Contributor Author

abvf commented Aug 4, 2024

Hi @abondar,

I have added a test with the Event model, as its primary key is not id. The test will fail without the fix committed in this pull request.

@abondar abondar merged commit 1353ac1 into tortoise:develop Aug 5, 2024
7 checks passed
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.

3 participants