summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/db/migrations/operations/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index 4c9467cc0d..888b2851da 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -751,6 +751,11 @@ class AddIndex(Operation):
def __init__(self, model_name, index):
self.model_name = model_name
+ if not index._name:
+ raise ValueError(
+ "Indexes passed to AddIndex operations require a name "
+ "argument. %r doesn't have one." % index
+ )
self.index = index
def state_forwards(self, app_label, state):