diff options
| author | Marc Tamlyn <marc.tamlyn@gmail.com> | 2014-09-04 16:32:51 +0100 |
|---|---|---|
| committer | Marc Tamlyn <marc.tamlyn@gmail.com> | 2014-09-06 19:01:06 +0100 |
| commit | 14c8456ffe7e6388383e6fe5c3f51cd20810ea49 (patch) | |
| tree | 367c509d9f75b976657551fe12b3ae689f512577 /django | |
| parent | e5febfb3c3873e535be1cde047a1f738922564d5 (diff) | |
Fixed #23416 -- Make sure DatabaseCreation respects checks.
Migrations respected Field.db_parameters()['check'], but
DatabaseCreation was still using just Field.db_type().
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/creation.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py index 99c49590e0..9077399adc 100644 --- a/django/db/backends/creation.py +++ b/django/db/backends/creation.py @@ -77,7 +77,10 @@ class BaseDatabaseCreation(object): pending_references = {} qn = self.connection.ops.quote_name for f in opts.local_fields: - col_type = f.db_type(connection=self.connection) + db_params = f.db_parameters(connection=self.connection) + col_type = db_params['type'] + if db_params['check']: + col_type = '%s CHECK (%s)' % (col_type, db_params['check']) col_type_suffix = f.db_type_suffix(connection=self.connection) tablespace = f.db_tablespace or opts.db_tablespace if col_type is None: |
