diff --git a/corehq/apps/cleanup/migrations/0018_delete_ewsghana_models.py b/corehq/apps/cleanup/migrations/0018_delete_ewsghana_models.py new file mode 100644 index 000000000000..f4d9153e3a00 --- /dev/null +++ b/corehq/apps/cleanup/migrations/0018_delete_ewsghana_models.py @@ -0,0 +1,50 @@ +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cleanup', '0017_delete_oauth_integrations_models'), + ] + + operations = [ + migrations.RunSQL(""" + DROP TABLE IF EXISTS "ewsghana_facilityincharge" CASCADE; + DROP TABLE IF EXISTS "ewsghana_ewsextension" CASCADE; + DROP TABLE IF EXISTS "ewsghana_sqlnotification" CASCADE; + """), + ] + + +""" +Dropped entities can be checked with the following query: + select pg_describe_object(classid, objid, objsubid) + from pg_depend + where refobjid in ( + 'ewsghana_facilityincharge'::regclass, + 'ewsghana_ewsextension'::regclass, + 'ewsghana_sqlnotification'::regclass + ); +Example output (from production): + type ewsghana_ewsextension + sequence ewsghana_ewsextension_id_seq + type ewsghana_facilityincharge + sequence ewsghana_facilityincharge_id_seq + type ewsghana_sqlnotification + sequence ewsghana_sqlnotification_id_seq + default value for column id of table ewsghana_ewsextension + default value for column id of table ewsghana_facilityincharge + default value for column id of table ewsghana_sqlnotification + constraint ewsghana_ewsextension_pkey on table ewsghana_ewsextension + constraint ewsghana_facilityincharge_pkey on table ewsghana_facilityincharge + constraint ewsghana_sqlnotification_pkey on table ewsghana_sqlnotification + index ewsghana_ewsextension_e274a5da + index ewsghana_ewsextension_e8701ad4 + index ewsghana_ewsextension_location_id_636bec0358987f83_like + index ewsghana_ewsextension_user_id_6cff5f4a22d0e14b_like + index ewsghana_facilityincharge_location_id + index ewsghana_facilityincharge_user_id + index ewsghana_facilityincharge_user_id_like + constraint ewsgha_location_id_4879eb14d7a4a143_fk_locations_sqllocation_id on table ewsghana_facilityincharge +(20 rows) +""" diff --git a/corehq/apps/reports/static/reports/js/bootstrap3/standard_hq_report.js b/corehq/apps/reports/static/reports/js/bootstrap3/standard_hq_report.js index 5ddcb3f4c892..672e6956bce5 100644 --- a/corehq/apps/reports/static/reports/js/bootstrap3/standard_hq_report.js +++ b/corehq/apps/reports/static/reports/js/bootstrap3/standard_hq_report.js @@ -21,7 +21,7 @@ hqDefine("reports/js/bootstrap3/standard_hq_report", [ } if (typeof standardHQReport !== 'undefined') { - // Custom reports, notably ewsghana + // Custom reports standardReport = standardHQReport; } else { // Standard reports diff --git a/corehq/apps/reports/static/reports/js/bootstrap5/standard_hq_report.js b/corehq/apps/reports/static/reports/js/bootstrap5/standard_hq_report.js index a2d0f61471bd..1bc2a4b1fd4d 100644 --- a/corehq/apps/reports/static/reports/js/bootstrap5/standard_hq_report.js +++ b/corehq/apps/reports/static/reports/js/bootstrap5/standard_hq_report.js @@ -23,7 +23,7 @@ hqDefine("reports/js/bootstrap5/standard_hq_report", [ } if (typeof standardHQReport !== 'undefined') { - // Custom reports, notably ewsghana + // Custom reports standardReport = standardHQReport; } else { // Standard reports diff --git a/custom/ewsghana/models.py b/custom/ewsghana/models.py deleted file mode 100644 index 9516d5b31071..000000000000 --- a/custom/ewsghana/models.py +++ /dev/null @@ -1,52 +0,0 @@ -from corehq.apps.domain.models import Domain -from corehq.apps.locations.models import SQLLocation, get_location -from corehq.apps.sms.models import PhoneNumber -from corehq.apps.users.models import WebUser -from django.db import models - - -class FacilityInCharge(models.Model): - user_id = models.CharField(max_length=128, db_index=True) - location = models.ForeignKey(SQLLocation, on_delete=models.PROTECT) - - class Meta(object): - app_label = 'ewsghana' - - -class EWSExtension(models.Model): - user_id = models.CharField(max_length=128, db_index=True) - domain = models.CharField(max_length=128) - location_id = models.CharField(max_length=128, null=True, db_index=True) - sms_notifications = models.BooleanField(default=False) - - @property - def supply_point(self): - if not self.location_id: - return - return get_location(self.location_id).linked_supply_point() - - @property - def web_user(self): - return WebUser.get(self.user_id) - - @property - def verified_number(self): - return PhoneNumber.get_two_way_number(self.phone_number) - - @property - def domain_object(self): - return Domain.get_by_name(self.domain) - - class Meta(object): - app_label = 'ewsghana' - - -class SQLNotification(models.Model): - domain = models.CharField(max_length=128) - user_id = models.CharField(max_length=128) - type = models.CharField(max_length=128) - week = models.IntegerField() - year = models.IntegerField() - - class Meta(object): - app_label = 'ewsghana' diff --git a/migrations.lock b/migrations.lock index fbb6b66e74b9..bfe989bc244c 100644 --- a/migrations.lock +++ b/migrations.lock @@ -256,6 +256,7 @@ cleanup 0015_deletedcouchdoc_unique_id_and_type 0016_add_deletedsqldoc 0017_delete_oauth_integrations_models + 0018_delete_ewsghana_models cloudcare 0001_initial 0002_sqlapplicationaccess