30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
# 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(%(maxlength)s)',
|
|
'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
|
|
'DateField': 'date',
|
|
'DateTimeField': 'datetime',
|
|
'FileField': 'varchar(100)',
|
|
'FilePathField': 'varchar(100)',
|
|
'FloatField': 'numeric(%(max_digits)s, %(decimal_places)s)',
|
|
'ImageField': 'varchar(100)',
|
|
'IntegerField': 'integer',
|
|
'IPAddressField': 'char(15)',
|
|
'ManyToManyField': None,
|
|
'NullBooleanField': 'bool',
|
|
'OneToOneField': 'integer',
|
|
'PhoneNumberField': 'varchar(20)',
|
|
'PositiveIntegerField': 'integer UNSIGNED',
|
|
'PositiveSmallIntegerField': 'smallint UNSIGNED',
|
|
'SlugField': 'varchar(%(maxlength)s)',
|
|
'SmallIntegerField': 'smallint',
|
|
'TextField': 'longtext',
|
|
'TimeField': 'time',
|
|
'USStateField': 'varchar(2)',
|
|
}
|