|
1 # This dictionary maps Field objects to their associated PostgreSQL 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': 'serial', |
|
7 'BooleanField': 'boolean', |
|
8 'CharField': 'varchar(%(max_length)s)', |
|
9 'CommaSeparatedIntegerField': 'varchar(%(max_length)s)', |
|
10 'DateField': 'date', |
|
11 'DateTimeField': 'timestamp with time zone', |
|
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': 'inet', |
|
19 'NullBooleanField': 'boolean', |
|
20 'OneToOneField': 'integer', |
|
21 'PhoneNumberField': 'varchar(20)', |
|
22 'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)', |
|
23 'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)', |
|
24 'SlugField': 'varchar(%(max_length)s)', |
|
25 'SmallIntegerField': 'smallint', |
|
26 'TextField': 'text', |
|
27 'TimeField': 'time', |
|
28 'USStateField': 'varchar(2)', |
|
29 } |