diff options
author | Andrew Godwin <andrew@aeracode.org> | 2012-09-07 15:40:59 -0400 |
---|---|---|
committer | Andrew Godwin <andrew@aeracode.org> | 2012-09-07 15:40:59 -0400 |
commit | ca9c3cd39fade827cced1b5198dd37bb80c208b0 (patch) | |
tree | 8a0a7d7c048d33798efa5baed8b51140a774bc90 /django/db/backends/postgresql_psycopg2/creation.py | |
parent | 375178fc19c1170fe046ad26befeba02fc19548c (diff) | |
download | django-ca9c3cd39fade827cced1b5198dd37bb80c208b0.tar.gz |
Add check constraint support - needed a few Field changes
Diffstat (limited to 'django/db/backends/postgresql_psycopg2/creation.py')
-rw-r--r-- | django/db/backends/postgresql_psycopg2/creation.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/django/db/backends/postgresql_psycopg2/creation.py b/django/db/backends/postgresql_psycopg2/creation.py index ca389b9046..f131d14abe 100644 --- a/django/db/backends/postgresql_psycopg2/creation.py +++ b/django/db/backends/postgresql_psycopg2/creation.py @@ -26,14 +26,19 @@ class DatabaseCreation(BaseDatabaseCreation): 'GenericIPAddressField': 'inet', 'NullBooleanField': 'boolean', 'OneToOneField': 'integer', - 'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)', - 'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)', + 'PositiveIntegerField': 'integer', + 'PositiveSmallIntegerField': 'smallint', 'SlugField': 'varchar(%(max_length)s)', 'SmallIntegerField': 'smallint', 'TextField': 'text', 'TimeField': 'time', } + data_type_check_constraints = { + 'PositiveIntegerField': '"%(column)s" >= 0', + 'PositiveSmallIntegerField': '"%(column)s" >= 0', + } + def sql_table_creation_suffix(self): assert self.connection.settings_dict['TEST_COLLATION'] is None, "PostgreSQL does not support collation setting at database creation time." if self.connection.settings_dict['TEST_CHARSET']: |