summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/checks.txt5
-rw-r--r--docs/releases/1.8.txt22
2 files changed, 27 insertions, 0 deletions
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt
index aedaa921db..85cd616253 100644
--- a/docs/ref/checks.txt
+++ b/docs/ref/checks.txt
@@ -58,6 +58,11 @@ Models
* **models.E016**: ``index_together/unique_together`` refers to field
``<field_name>`` which is not local to model ``<model>``.
* **models.E017**: Proxy model ``<model>`` contains model fields.
+* **models.E018**: Autogenerated column name too long for field ``<field>``.
+ Maximum length is ``<maximum length>`` for database ``<alias>``.
+* **models.E019**: Autogenerated column name too long for M2M field
+ ``<M2M field>``. Maximum length is ``<maximum length>`` for database
+ ``<alias>``.
Fields
~~~~~~
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index c54e1d5ab0..7f3b4aa6c7 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -305,6 +305,28 @@ Now to implement the same behavior, you have to create an
``parser.add_argument`` to add any custom arguments, as parser is now an
:py:class:`argparse.ArgumentParser` instance.
+Model check ensures auto-generated column names are within limits specified by database
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A field name that's longer than the column name length supported by a database
+can create problems. For example, with MySQL you'll get an exception trying to
+create the column, and with PostgreSQL the column name is truncated by the
+database (you may see a warning in the PostgreSQL logs).
+
+A model check has been introduced to better alert users to this scenario before
+the actual creation of database tables.
+
+If you have an existing model where this check seems to be a false positive,
+for example on PostgreSQL where the name was already being truncated, simply
+use :attr:`~django.db.models.Field.db_column` to specify the name that's being
+used.
+
+The check also applies to the columns generated in an implicit
+``ManyToManyField.through`` model. If you run into an issue there, use
+:attr:`~django.db.models.ManyToManyField.through` to create an explicit model
+and then specify :attr:`~django.db.models.Field.db_column` on its column(s)
+as needed.
+
Miscellaneous
~~~~~~~~~~~~~