Skip to content

Conversation

@waketzheng
Copy link
Contributor

Description

Fixes #1893

Motivation and Context

The new function _get_m2m_tables has argument table_name which is conflict with variable defined at https://github.com/tortoise/tortoise-orm/blob/0.24.1/tortoise/backends/base/schema_generator.py#L327

How Has This Been Tested?

make ci

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.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 25, 2025

CodSpeed Performance Report

Merging #1897 will not alter performance

Comparing waketzheng:fix-multi-m2m (515370a) with develop (40b427d)

Summary

✅ 16 untouched benchmarks

@coveralls
Copy link

coveralls commented Feb 25, 2025

Pull Request Test Coverage Report for Build 13540764588

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

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

Totals Coverage Status
Change from base Build 13496646441: 0.006%
Covered Lines: 6592
Relevant Lines: 7191

💛 - Coveralls

@vincentWuK
Copy link

same issue! thx for fix!

else:
backward_fk = forward_fk = ""
exists = "IF NOT EXISTS " if safe else ""
table_name = field_object.through
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no semantic difference between db_table and table_name names but actually they are very different. Let's rename table_name to through_table_name.

@waketzheng waketzheng merged commit 466ddfa into tortoise:develop Feb 26, 2025
8 checks passed
@waketzheng waketzheng deleted the fix-multi-m2m branch February 26, 2025 12:02
@henadzit henadzit 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.

Create schema with multi m2m fields raises OperationalError: column "id" referenced in foreign key constraint does not exist

4 participants