app/django/db/backends/mysql_old/creation.py
changeset 54 03e267d67478
equal deleted inserted replaced
53:57b4279d8c4e 54:03e267d67478
       
     1 # This dictionary maps Field objects to their associated MySQL column
       
     2 # types, as strings. Column-type strings can contain format strings; they'll
       
     3 # be interpolated against the values of Field.__dict__ before being output.
       
     4 # If a column type is set to None, it won't be included in the output.
       
     5 DATA_TYPES = {
       
     6     'AutoField':         'integer AUTO_INCREMENT',
       
     7     'BooleanField':      'bool',
       
     8     'CharField':         'varchar(%(max_length)s)',
       
     9     'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
       
    10     'DateField':         'date',
       
    11     'DateTimeField':     'datetime',
       
    12     'DecimalField':      'numeric(%(max_digits)s, %(decimal_places)s)',
       
    13     'FileField':         'varchar(%(max_length)s)',
       
    14     'FilePathField':     'varchar(%(max_length)s)',
       
    15     'FloatField':        'double precision',
       
    16     'ImageField':        'varchar(%(max_length)s)',
       
    17     'IntegerField':      'integer',
       
    18     'IPAddressField':    'char(15)',
       
    19     'NullBooleanField':  'bool',
       
    20     'OneToOneField':     'integer',
       
    21     'PhoneNumberField':  'varchar(20)',
       
    22     'PositiveIntegerField': 'integer UNSIGNED',
       
    23     'PositiveSmallIntegerField': 'smallint UNSIGNED',
       
    24     'SlugField':         'varchar(%(max_length)s)',
       
    25     'SmallIntegerField': 'smallint',
       
    26     'TextField':         'longtext',
       
    27     'TimeField':         'time',
       
    28     'USStateField':      'varchar(2)',
       
    29 }