On Mon, Mar 14, 2016 at 12:45:09AM -0700, akki wrote:
> Hi Annsi
> 
> Yes, the AddIndex operation would detect the changes and the user would not 
> have full control over the generated SQL.
> 
> I don't know if it would be a good idea to mix index definitions with 
> fields while creating models. Users have traditionally been defining fields 
> that way and indexes feel more like a "Meta" property to me. Constraints 
> can also be added to Meta (maybe merged together with indexes) whenever 
> they arrive, but I don't how soon they will be included.

The way I see it, the question is: how well can we maintain this
distinction (column-backed fields in the model class itself, vs.
non-field constructs in Meta). Right now the boundary between the two
is more or less clear, with a few exceptions (ManyToManyField and
GenericForeignKey, for instance). Once we grow support for
CompositeFields, that will be another construct which looks kind of
like a limited field from one angle, but actually resembles non-field
constructs in a SQL table, too. If I ever manage to dust off and push
through my ForeignKey refactor, even ForeignKey would become this kind
of virtual construct -- just a named SQL constraint with some
Python-level behavior tacked on top of it.

To be honest, personally, I kind of like SQLAlchemy's approach, which
simply puts all table-level constructs (columns, constraints, indexes)
into model classes at the same level. It does not leave room for this
kind of subjective bikeshedding.

Cheers,

Michal

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20160314084424.GO25061%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

  • P... akki
    • ... Josh Smeaton
      • ... Anssi Kääriäinen
        • ... akki
          • ... Markus Holtermann
          • ... Anssi Kääriäinen
            • ... 'Moritz Sichert' via Django developers (Contributions to Django itself)

Reply via email to