Skip to content

Commit

Permalink
Merge pull request #34169 from dimagi/ml/add-deletedsqldoc-model
Browse files Browse the repository at this point in the history
Add DeletedSQLDoc model
  • Loading branch information
minhaminha authored Feb 27, 2024
2 parents 3ca8866 + 00e75f9 commit 2263ab9
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
32 changes: 32 additions & 0 deletions corehq/apps/cleanup/migrations/0016_add_deletedsqldoc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 3.2.23 on 2024-02-16 21:11

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('cleanup', '0015_deletedcouchdoc_unique_id_and_type'),
]

operations = [
migrations.CreateModel(
name='DeletedSQLDoc',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('doc_id', models.CharField(max_length=126)),
('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={
'db_table': 'cleanup_deletedsqldoc',
},
),
migrations.AddConstraint(
model_name='deletedsqldoc',
constraint=models.UniqueConstraint(fields=('doc_id', 'object_class_path'),
name='deletedsqldoc_unique_id_and_type'),
),
]
15 changes: 15 additions & 0 deletions corehq/apps/cleanup/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ class Meta:
constraints = [
models.UniqueConstraint(fields=['doc_id', 'doc_type'], name='deletedcouchdoc_unique_id_and_type')
]


class DeletedSQLDoc(models.Model):
doc_id = models.CharField(max_length=126)
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', 'object_class_path'],
name='deletedsqldoc_unique_id_and_type')
]
1 change: 1 addition & 0 deletions corehq/apps/domain/tests/test_deletion_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
'blobs.BlobMigrationState',
'blobs.DeletedBlobMeta',
'cleanup.DeletedCouchDoc',
'cleanup.DeletedSQLDoc',
'domain.DomainAuditRecordEntry',
'domain.ProjectLimit',
'domain.SuperuserProjectEntryRecord',
Expand Down
1 change: 1 addition & 0 deletions corehq/apps/dump_reload/tests/test_dump_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"auth.Permission",
"blobs.BlobMigrationState",
"cleanup.DeletedCouchDoc",
"cleanup.DeletedSQLDoc",
"contenttypes.ContentType",
"data_analytics.GIRRow",
"data_analytics.MALTRow",
Expand Down
1 change: 1 addition & 0 deletions migrations.lock
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ cleanup
0013_migrate_kafka_checkpoint_format
0014_deletedcouchdoc
0015_deletedcouchdoc_unique_id_and_type
0016_add_deletedsqldoc
cloudcare
0001_initial
0002_sqlapplicationaccess
Expand Down

0 comments on commit 2263ab9

Please sign in to comment.