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

refactor: use 'unique' instead of 'create_unique_index' for m2m field #1903

Merged
merged 9 commits into from
Mar 3, 2025

Conversation

waketzheng
Copy link
Contributor

Description

Related issue: tortoise/aerich#406

Copy link

codspeed-hq bot commented Feb 28, 2025

CodSpeed Performance Report

Merging #1903 will not alter performance

Comparing waketzheng:update-m2m-describe (b3d934a) with develop (587d8a0)

Summary

✅ 16 untouched benchmarks

@waketzheng waketzheng changed the title feat: add 'create_unique_index' to model describe refactor: use unique instead of 'create_unique_index' for m2m field Mar 1, 2025
@coveralls
Copy link

coveralls commented Mar 1, 2025

Pull Request Test Coverage Report for Build 13615519024

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 89.432%

Totals Coverage Status
Change from base Build 13543696852: 0.005%
Covered Lines: 6595
Relevant Lines: 7194

💛 - Coveralls

@waketzheng waketzheng changed the title refactor: use unique instead of 'create_unique_index' for m2m field refactor: use 'unique' instead of 'create_unique_index' for m2m field Mar 1, 2025
@waketzheng waketzheng requested a review from henadzit March 1, 2025 04:21
**kwargs: Any,
) -> None:
# TODO: rename through to through_table
# TODO: add through to use a Model
super().__init__(field_type, **kwargs)
super().__init__(field_type, unique=unique, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to pass unique explicitly here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because ManyToManyFieldInstance inherit from class Field, which receive the unique parameter.

@waketzheng waketzheng requested a review from henadzit March 2, 2025 13:14
Copy link
Contributor

@henadzit henadzit left a comment

Choose a reason for hiding this comment

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

LGTM! Although we should also update CHANGELOG, however, we can do it when doing a release.

@waketzheng waketzheng merged commit d8aeb1e into tortoise:develop Mar 3, 2025
9 checks passed
@waketzheng waketzheng mentioned this pull request Mar 3, 2025
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