|
4 | 4 | from django.db.backends.base.schema import ( |
5 | 5 | BaseDatabaseSchemaEditor, logger, _related_non_m2m_objects, |
6 | 6 | ) |
7 | | -from django.db.models.fields import AutoField |
| 7 | +from django.db.models.fields import AutoField, BigAutoField |
8 | 8 | from django.db.models.fields.related import ManyToManyField |
9 | 9 | from django.utils import six |
10 | 10 | from django.utils.text import force_text |
@@ -57,10 +57,11 @@ def _alter_field(self, model, old_field, new_field, old_type, new_type, |
57 | 57 | old_db_params, new_db_params, strict=False): |
58 | 58 | """Actually perform a "physical" (non-ManyToMany) field update.""" |
59 | 59 |
|
60 | | - # the backend doesn't support altering from/to AutoField |
| 60 | + # the backend doesn't support altering from/to (Big)AutoField |
61 | 61 | # because of the limited capability of SQL Server to edit IDENTITY property |
62 | | - if isinstance(old_field, AutoField) or isinstance(new_field, AutoField): |
63 | | - raise NotImplementedError("the backend doesn't support altering from/to AutoField.") |
| 62 | + for t in (AutoField, BigAutoField): |
| 63 | + if isinstance(old_field, t) or isinstance(new_field, t): |
| 64 | + raise NotImplementedError("the backend doesn't support altering from/to %s." % t.__name__) |
64 | 65 | # Drop any FK constraints, we'll remake them later |
65 | 66 | fks_dropped = set() |
66 | 67 | if old_field.remote_field and old_field.db_constraint: |
|
0 commit comments