Deprecate inline indexes/unique constraints on embedded model fields

XMLWordPrintableJSON

    • None
    • Python Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Fields of embedded models can use unique=True and db_index=True, as well as the model's Meta.constraints and Meta.unique_constraints to define unique constraints and indexes, however, these indexes/constraints are only created if they are declared for the model's creation (CreateModel migration operation) as proper schema detection for embedded model fields isn't implemented.

      Now that indexes and unique constraints can be declared on embedded model fields from the top-level model (INTPYTHON-698, INTPYTHON-904), declaring constraints/indexes inline as described in the previous paragraph will be deprecated in favor of top-level constraints/indexes.

      Definition of done

      The system check framework will issue a deprecation warning for any models that use inline constraints/indexes. This warning will change to an error in Django MongoDB Backend 6.1 when the deprecation ends.

            Assignee:
            Tim Graham
            Reporter:
            Tim Graham
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: