summaryrefslogtreecommitdiff
path: root/tests/schema
diff options
context:
space:
mode:
Diffstat (limited to 'tests/schema')
-rw-r--r--tests/schema/tests.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index 287ef200da..a765528d50 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -636,6 +636,26 @@ class SchemaTests(TransactionTestCase):
with connection.schema_editor() as editor:
editor.alter_field(Author, old_field, new_field, strict=True)
+ @isolate_apps('schema')
+ def test_alter_auto_field_quoted_db_column(self):
+ class Foo(Model):
+ id = AutoField(primary_key=True, db_column='"quoted_id"')
+
+ class Meta:
+ app_label = 'schema'
+
+ with connection.schema_editor() as editor:
+ editor.create_model(Foo)
+ self.isolated_local_models = [Foo]
+ old_field = Foo._meta.get_field('id')
+ new_field = BigAutoField(primary_key=True)
+ new_field.model = Foo
+ new_field.db_column = '"quoted_id"'
+ new_field.set_attributes_from_name('id')
+ with connection.schema_editor() as editor:
+ editor.alter_field(Foo, old_field, new_field, strict=True)
+ Foo.objects.create()
+
def test_alter_not_unique_field_to_primary_key(self):
# Create the table.
with connection.schema_editor() as editor: