Ticket #8316: db-mysqltypeissue.diff
File db-mysqltypeissue.diff, 3.4 KB (added by , 16 years ago) |
---|
-
django/db/backends/mysql/creation.py
19 19 'FloatField': 'double precision', 20 20 'IntegerField': 'integer', 21 21 'IPAddressField': 'char(15)', 22 'KeyField': 'integer', 22 23 'NullBooleanField': 'bool', 23 24 'OneToOneField': 'integer', 24 25 'PhoneNumberField': 'varchar(20)', -
django/db/backends/oracle/creation.py
28 28 'FloatField': 'DOUBLE PRECISION', 29 29 'IntegerField': 'NUMBER(11)', 30 30 'IPAddressField': 'VARCHAR2(15)', 31 'KeyField': 'NUMBER(11)', 31 32 'NullBooleanField': 'NUMBER(1) CHECK ((%(qn_column)s IN (0,1)) OR (%(qn_column)s IS NULL))', 32 33 'OneToOneField': 'NUMBER(11)', 33 34 'PhoneNumberField': 'VARCHAR2(20)', -
django/db/backends/postgresql/creation.py
19 19 'FloatField': 'double precision', 20 20 'IntegerField': 'integer', 21 21 'IPAddressField': 'inet', 22 'KeyField': 'integer', 22 23 'NullBooleanField': 'boolean', 23 24 'OneToOneField': 'integer', 24 25 'PhoneNumberField': 'varchar(20)', -
django/db/backends/sqlite3/creation.py
20 20 'FloatField': 'real', 21 21 'IntegerField': 'integer', 22 22 'IPAddressField': 'char(15)', 23 'KeyField': 'integer', 23 24 'NullBooleanField': 'bool', 24 25 'OneToOneField': 'integer', 25 26 'PhoneNumberField': 'varchar(20)', -
django/db/models/fields/related.py
710 710 def db_type(self): 711 711 # The database column type of a ForeignKey is the column type 712 712 # of the field to which it points. An exception is if the ForeignKey 713 # points to an AutoField /PositiveIntegerField/PositiveSmallIntegerField,714 # in which case the column type is simply that of an IntegerField.713 # points to an AutoField, in which case the column type is simply that 714 # of a KeyField. 715 715 rel_field = self.rel.get_related_field() 716 if isinstance(rel_field, (AutoField, PositiveIntegerField, PositiveSmallIntegerField)):717 return IntegerField().db_type()716 if isinstance(rel_field, AutoField): 717 return KeyField().db_type() 718 718 return rel_field.db_type() 719 719 720 720 class OneToOneField(ForeignKey):