diff --git a/corehq/apps/cleanup/migrations/0016_add_deletedsqldoc.py b/corehq/apps/cleanup/migrations/0016_add_deletedsqldoc.py index 1452f33e3008..42580c5008e0 100644 --- a/corehq/apps/cleanup/migrations/0016_add_deletedsqldoc.py +++ b/corehq/apps/cleanup/migrations/0016_add_deletedsqldoc.py @@ -15,9 +15,9 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('doc_id', models.CharField(max_length=126)), - ('doc_type', models.CharField(max_length=255)), - ('deleted_on', models.DateTimeField(db_index=True)), + ('object_class_path', models.CharField(max_length=255)), ('domain', models.CharField(max_length=255)), + ('deleted_on', models.DateTimeField(db_index=True)), ('deleted_by', models.CharField(max_length=126, null=True)), ], options={ @@ -26,6 +26,7 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='deletedsqldoc', - constraint=models.UniqueConstraint(fields=('doc_id', 'doc_type'), name='deletedsqldoc_unique_id_and_type'), + constraint=models.UniqueConstraint(fields=('doc_id', 'object_class_path'), + name='deletedsqldoc_unique_id_and_type'), ), ] diff --git a/corehq/apps/cleanup/models.py b/corehq/apps/cleanup/models.py index 4e77568690a2..689eefca55ea 100644 --- a/corehq/apps/cleanup/models.py +++ b/corehq/apps/cleanup/models.py @@ -14,13 +14,14 @@ class Meta: class DeletedSQLDoc(models.Model): doc_id = models.CharField(max_length=126) - doc_type = models.CharField(max_length=255) - deleted_on = models.DateTimeField(db_index=True) + object_class_path = models.CharField(max_length=255) domain = models.CharField(max_length=255) + deleted_on = models.DateTimeField(db_index=True) deleted_by = models.CharField(max_length=126, null=True) class Meta: db_table = "cleanup_deletedsqldoc" constraints = [ - models.UniqueConstraint(fields=['doc_id', 'doc_type'], name='deletedsqldoc_unique_id_and_type') + models.UniqueConstraint(fields=['doc_id', 'object_class_path'], + name='deletedsqldoc_unique_id_and_type') ]