diff options
author | Ngalim Siregar <ngalim.siregar@gmail.com> | 2019-07-31 19:02:15 +0700 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-08-01 12:06:32 +0200 |
commit | e4684220af058789a9d2673a3503d2f88d8aa94a (patch) | |
tree | 9a99cf1a96744512c52322075a7a6684438ff8f4 /django/db/backends/postgresql/schema.py | |
parent | a5652eb795e896df0c0f2515201f35f9cd86b99b (diff) | |
download | django-e4684220af058789a9d2673a3503d2f88d8aa94a.tar.gz |
Fixed #30664 -- Fixed migrations crash when altering table on SQLite or altering AutoField/BigAutoField on PostgreSQL for models with quoted db_table.
Diffstat (limited to 'django/db/backends/postgresql/schema.py')
-rw-r--r-- | django/db/backends/postgresql/schema.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py index 82e91ce840..9e07bccf8b 100644 --- a/django/db/backends/postgresql/schema.py +++ b/django/db/backends/postgresql/schema.py @@ -2,6 +2,7 @@ import psycopg2 from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.ddl_references import IndexColumns +from django.db.backends.utils import strip_quotes class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): @@ -67,7 +68,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): if self._field_data_type(old_field) != self._field_data_type(new_field): self.sql_alter_column_type += ' USING %(column)s::%(type)s' # Make ALTER TYPE with SERIAL make sense. - table = model._meta.db_table + table = strip_quotes(model._meta.db_table) if new_type.lower() in ("serial", "bigserial"): column = new_field.column sequence_name = "%s_%s_seq" % (table, column) |