app/django/db/backends/sqlite3/creation.py
author Todd Larsen <tlarsen@google.com>
Thu, 25 Sep 2008 17:17:11 +0000
changeset 202 b8b4a83788d4
parent 54 03e267d67478
child 323 ff1a9aa48cfd
permissions -rw-r--r--
A key_name controller module to collect all of the name...() functions that compose Model entity key names, plus some minor changes to other controller modules to illustrate the proposed use. Patch by: Todd Larsen Review by: Pawel Solyga Review URL: http://codereviews.googleopensourceprograms.com/804 Review URL: http://codereviews.googleopensourceprograms.com/804

# SQLite doesn't actually support most of these types, but it "does the right
# thing" given more verbose field definitions, so leave them as is so that
# schema inspection is more useful.
DATA_TYPES = {
    'AutoField':                    'integer',
    'BooleanField':                 'bool',
    'CharField':                    'varchar(%(max_length)s)',
    'CommaSeparatedIntegerField':   'varchar(%(max_length)s)',
    'DateField':                    'date',
    'DateTimeField':                'datetime',
    'DecimalField':                 'decimal',
    'FileField':                    'varchar(%(max_length)s)',
    'FilePathField':                'varchar(%(max_length)s)',
    'FloatField':                   'real',
    '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':                    'text',
    'TimeField':                    'time',
    'USStateField':                 'varchar(2)',
}