Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create DomainMetrics SQL table #35415

Merged
merged 8 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions corehq/apps/data_analytics/migrations/0011_domainstats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.16 on 2024-11-21 17:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('data_analytics', '0010_maltrow_last_run_date'),
]

operations = [
migrations.CreateModel(
name='DomainStats',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.TextField(db_index=True, unique=True)),
('stats', models.JSONField()),
('date_created', models.DateTimeField(auto_now_add=True)),
('last_modified', models.DateTimeField(auto_now=True)),
],
),
]
7 changes: 7 additions & 0 deletions corehq/apps/data_analytics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,10 @@ def export_row(self, past_months):
experienced_threshold=self.experienced_threshold or DEFAULT_EXPERIENCED_THRESHOLD,
performance_threshold=self.performance_threshold or DEFAULT_PERFORMANCE_THRESHOLD,
)


class DomainStats(models.Model):
domain = models.TextField(unique=True, db_index=True)
stats = models.JSONField()
gherceg marked this conversation as resolved.
Show resolved Hide resolved
date_created = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
1 change: 1 addition & 0 deletions corehq/apps/domain/deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ def _delete_demo_user_restores(domain_name):
ModelDeletion('custom_data_fields', 'CustomDataFieldsDefinition', 'domain', [
'CustomDataFieldsProfile', 'Field',
]),
ModelDeletion('data_analytics', 'DomainStats', 'domain'),
ModelDeletion('data_analytics', 'GIRRow', 'domain_name'),
ModelDeletion('data_analytics', 'MALTRow', 'domain_name'),
ModelDeletion('data_dictionary', 'CaseType', 'domain', [
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 @@ -52,6 +52,7 @@
"cleanup.DeletedCouchDoc",
"cleanup.DeletedSQLDoc",
"contenttypes.ContentType",
"data_analytics.DomainStats",
"data_analytics.GIRRow",
"data_analytics.MALTRow",
"django_celery_results.ChordCounter",
Expand Down
1 change: 1 addition & 0 deletions migrations.lock
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ data_analytics
0008_auto_20161114_1903
0009_remove_girrow_wam
0010_maltrow_last_run_date
0011_domainstats
data_dictionary
0001_squashed_0002_auto_20161116_2209
0002_auto_20161118_1537
Expand Down
Loading