Fixed #24533 -- Dropped PostgreSQL sequence and Oracle identity when migrating away from AutoField.

This commit is contained in:
Tim Graham 2020-08-22 14:32:01 -04:00 committed by Mariusz Felisiak
parent b312421511
commit ea880ec233
3 changed files with 29 additions and 0 deletions

View file

@ -677,6 +677,11 @@ class SchemaTests(TransactionTestCase):
new_field.model = Author
with connection.schema_editor() as editor:
editor.alter_field(Author, old_field, new_field, strict=True)
# Now that ID is an IntegerField, the database raises an error if it
# isn't provided.
if not connection.features.supports_unspecified_pk:
with self.assertRaises(DatabaseError):
Author.objects.create()
def test_alter_auto_field_to_char_field(self):
# Create the table