Ticket #16592: fix_unmanaged_models_tests.v2.diff

File fix_unmanaged_models_tests.v2.diff, 3.5 KB (added by Jim Dalton, 13 years ago)
  • docs/ref/databases.txt

    diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
    index 5a2042a..b66de0f 100644
    a b storage engine, you have a couple of options.  
    326326
    327327.. _AlterModelOnSyncDB: http://code.djangoproject.com/wiki/AlterModelOnSyncDB
    328328
     329Table names
     330-----------
     331
     332There are known issues in even the latest versions of MySQL that can cause the
     333case in a table name to be altered when certain SQL statements are executed
     334under certain conditions. It is recommended that you use lowercase table
     335names, if possible, to avoid any problems that might arise from this behavior.
     336Django uses lowercase table names when it auto-generates table names from
     337models, so this is mainly a consideration if you are overriding the table name
     338via the :class:`~django.db.models.Options.db_table` parameter.
     339
    329340Notes on specific fields
    330341------------------------
    331342
  • docs/ref/models/options.txt

    diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt
    index 4530439..44b2b5b 100644
    a b If your database table name is an SQL reserved word, or contains characters that  
    6161aren't allowed in Python variable names -- notably, the hyphen -- that's OK.
    6262Django quotes column and table names behind the scenes.
    6363
     64.. admonition:: Use lowercase table names
     65
     66    It is strongly advised that you use lowercase table names when you override
     67    the table name via ``db_table``, particularly if you are using the MySQL
     68    backend. See the :ref:`MySQL notes <mysql-notes>` for more details.
     69
     70
    6471``db_tablespace``
    6572-----------------
    6673
  • tests/modeltests/unmanaged_models/models.py

    diff --git a/tests/modeltests/unmanaged_models/models.py b/tests/modeltests/unmanaged_models/models.py
    index bfbd544..00303cf 100644
    a b class A01(models.Model):  
    1212    f_b = models.IntegerField()
    1313
    1414    class Meta:
    15         db_table = 'A01'
     15        db_table = 'a01'
    1616
    1717    def __unicode__(self):
    1818        return self.f_a
    class B01(models.Model):  
    2323    f_b = models.IntegerField()
    2424
    2525    class Meta:
    26         db_table = 'B01'
     26        db_table = 'b01'
    2727        # 'managed' is True by default. This tests we can set it explicitly.
    2828        managed = True
    2929
    class B01(models.Model):  
    3131        return self.f_a
    3232
    3333class C01(models.Model):
    34     mm_a = models.ManyToManyField(A01, db_table='D01')
     34    mm_a = models.ManyToManyField(A01, db_table='d01')
    3535    f_a = models.CharField(max_length=10, db_index=True)
    3636    f_b = models.IntegerField()
    3737
    3838    class Meta:
    39         db_table = 'C01'
     39        db_table = 'c01'
    4040
    4141    def __unicode__(self):
    4242        return self.f_a
    class A02(models.Model):  
    4949    f_a = models.CharField(max_length=10, db_index=True)
    5050
    5151    class Meta:
    52         db_table = 'A01'
     52        db_table = 'a01'
    5353        managed = False
    5454
    5555    def __unicode__(self):
    class A02(models.Model):  
    5757
    5858class B02(models.Model):
    5959    class Meta:
    60         db_table = 'B01'
     60        db_table = 'b01'
    6161        managed = False
    6262
    6363    fk_a = models.ForeignKey(A02)
    class C02(models.Model):  
    7575    f_b = models.IntegerField()
    7676
    7777    class Meta:
    78         db_table = 'C01'
     78        db_table = 'c01'
    7979        managed = False
    8080
    8181    def __unicode__(self):
    class Intermediate(models.Model):  
    8686    c02 = models.ForeignKey(C02, db_column="c01_id")
    8787
    8888    class Meta:
    89         db_table = 'D01'
     89        db_table = 'd01'
    9090        managed = False
    9191
    9292#
Back to Top