summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/schema.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-25 12:32:24 +0200
committerGitHub <noreply@github.com>2019-09-25 12:32:24 +0200
commit580e644f24f1c5ae5b94784fb73a9953a178fd26 (patch)
tree7cc67a5605ad0591b3d676351e78697ad51f78e2 /django/db/backends/postgresql/schema.py
parent566fca14b3e1406f918898de5bb2b2382a44edaf (diff)
downloaddjango-580e644f24f1c5ae5b94784fb73a9953a178fd26.tar.gz
Fixed #30800 -- Fixed migrations crash when altering a field with custom db_type().
Regression in 1378d665a1c85897d951f2ca9618b848fdbba2e7.
Diffstat (limited to 'django/db/backends/postgresql/schema.py')
-rw-r--r--django/db/backends/postgresql/schema.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py
index 9384c5e3b2..6a65d12415 100644
--- a/django/db/backends/postgresql/schema.py
+++ b/django/db/backends/postgresql/schema.py
@@ -42,7 +42,10 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
def _field_data_type(self, field):
if field.is_relation:
return field.rel_db_type(self.connection)
- return self.connection.data_types[field.get_internal_type()]
+ return self.connection.data_types.get(
+ field.get_internal_type(),
+ field.db_type(self.connection),
+ )
def _create_like_index_sql(self, model, field):
"""