-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
many-to-many nullable columns with through #852
base: master
Are you sure you want to change the base?
many-to-many nullable columns with through #852
Conversation
77fae53
to
4b7de5a
Compare
is_through_relation_column_nullable = kwargs.pop("is_through_relation_column_nullable", None) | ||
is_through_reverse_relation_column_nullable = kwargs.pop("is_through_reverse_relation_column_nullable", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename it to shorter names: through_relation_nullable
and through_reverse_relation_nullable
) | ||
create_and_append_m2m_fk( | ||
model=model_field.owner, model_field=model_field, field_name=child_name | ||
model=model_field.owner, model_field=model_field, field_name=child_name, nullable=model_field.is_through_relation_column_nullable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add missing tests for setting that column settings nullable/ not nullable and different expected behavior?
Sorry for the long review time! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #852 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 204 204
Lines 14845 14847 +2
=========================================
+ Hits 14845 14847 +2
|
CodSpeed Performance ReportMerging #852 will degrade performances by 12.33%Comparing Summary
Benchmarks breakdown
|
Hi @collerek |
such code:
cause such migration:
Here
ticker_id
andticker_collection_id
are nullable by default, and there is no built-in way to set them non nullable.I tried to set
sql_nullable
andnullable
in arguments oformar.ManyToMany
but looks like it affects only typing information.So then I added these two parameters, that will allow to override nullability of both
through
columns.