app/django/db/backends/mysql/creation.py
author Todd Larsen <tlarsen@google.com>
Tue, 26 Aug 2008 21:20:44 +0000
changeset 103 094c8f741a08
parent 54 03e267d67478
child 323 ff1a9aa48cfd
permissions -rw-r--r--
Move LICENSE.django closer to the actual trumk/app/django code we are importing (that exists in trunk/app to be part of the Google App Engine image). LICENSE.django cannot go in trunk/app/django itself, because that directory is maintained from the /vendor/django svn external using svn_load_dirs.pl (so putting all the way into trunk/app/django gets it repeatedly removed). Patch by: Todd Larsen Review by: to-be-reviewed

# This dictionary maps Field objects to their associated MySQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dict__ before being output.
# If a column type is set to None, it won't be included in the output.
DATA_TYPES = {
    'AutoField':         'integer AUTO_INCREMENT',
    'BooleanField':      'bool',
    'CharField':         'varchar(%(max_length)s)',
    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
    'DateField':         'date',
    'DateTimeField':     'datetime',
    'DecimalField':      'numeric(%(max_digits)s, %(decimal_places)s)',
    'FileField':         'varchar(%(max_length)s)',
    'FilePathField':     'varchar(%(max_length)s)',
    'FloatField':        'double precision',
    'ImageField':        'varchar(%(max_length)s)',
    'IntegerField':      'integer',
    'IPAddressField':    'char(15)',
    'NullBooleanField':  'bool',
    'OneToOneField':     'integer',
    'PhoneNumberField':  'varchar(20)',
    'PositiveIntegerField': 'integer UNSIGNED',
    'PositiveSmallIntegerField': 'smallint UNSIGNED',
    'SlugField':         'varchar(%(max_length)s)',
    'SmallIntegerField': 'smallint',
    'TextField':         'longtext',
    'TimeField':         'time',
    'USStateField':      'varchar(2)',
}