#35129: Support customize ForeignKey DDL when db_constraint=False
-------------------------------------+-------------------------------------
     Reporter:  elonzh               |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by elonzh):

 Replying to [comment:1 Mariusz Felisiak]:
 > `db_constraint` is only to disable creation of foreign key constraints
 in the tables and to allow for handling legacy database structures (if you
 don't other choice). It has nothing to do with a column data type that
 should always match a data type of the referenced column. Moreover,
 `max_length` is not a proper keyword argument for `ForeignKey` and as such
 is ignored.

 I know those parameters are intentionally ignored, what I want is joining
 tables without db_constraint. Django doesn't provide a method to achieve
 this, so I define a fake ForeignKey as a workround.

 I am curious that since it is allowed to set db_constraint=True for
 handling legacy database structures, why `max_length` should be always
 match a data type of the referenced column.

 This behavior will make unnessary migrations for legacy database
 structures, right?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/35129#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d2203f3a0-51f64e4f-a573-470a-aeb4-534eb6cf2ef7-000000%40eu-central-1.amazonses.com.

Reply via email to