2006-05-02 09:31:56 +08:00
|
|
|
# This dictionary maps Field objects to their associated PostgreSQL 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': 'serial',
|
|
|
|
'BooleanField': 'boolean',
|
2007-08-05 13:14:46 +08:00
|
|
|
'CharField': 'varchar(%(max_length)s)',
|
|
|
|
'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
|
2006-05-02 09:31:56 +08:00
|
|
|
'DateField': 'date',
|
|
|
|
'DateTimeField': 'timestamp with time zone',
|
2007-05-21 09:29:58 +08:00
|
|
|
'DecimalField': 'numeric(%(max_digits)s, %(decimal_places)s)',
|
2006-05-02 09:31:56 +08:00
|
|
|
'FileField': 'varchar(100)',
|
|
|
|
'FilePathField': 'varchar(100)',
|
2007-05-21 09:29:58 +08:00
|
|
|
'FloatField': 'double precision',
|
2006-05-02 09:31:56 +08:00
|
|
|
'ImageField': 'varchar(100)',
|
|
|
|
'IntegerField': 'integer',
|
|
|
|
'IPAddressField': 'inet',
|
|
|
|
'NullBooleanField': 'boolean',
|
|
|
|
'OneToOneField': 'integer',
|
|
|
|
'PhoneNumberField': 'varchar(20)',
|
|
|
|
'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)',
|
|
|
|
'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)',
|
2007-08-05 13:14:46 +08:00
|
|
|
'SlugField': 'varchar(%(max_length)s)',
|
2006-05-02 09:31:56 +08:00
|
|
|
'SmallIntegerField': 'smallint',
|
|
|
|
'TextField': 'text',
|
|
|
|
'TimeField': 'time',
|
|
|
|
'USStateField': 'varchar(2)',
|
|
|
|
}
|