diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b8fb48a2fa..baa2ef7a68 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,20 +1,19 @@ -Fixes [COST-####](https://issues.redhat.com/browse/COST-####) +## Jira Ticket -Changes proposed in this PR: -* -* +[COST-####](https://issues.redhat.com/browse/COST-####) -Testing Instructions: -1. Run `this command` ... -2. Ingest this data `with this other command` ... -3. Expect to see this result: - ``` - GET http://localhost:8000/api/endpoint +## Description - {json: response} - ``` -4. -5. +This change will ... ---- -Additional Context: +## Testing + +1. Checkout Branch +2. Restart Koku +3. Hit endpoint or launch shell + 1. You should see ... +4. Do more things... + +## Notes + +... diff --git a/koku/reporting/migrations/0256_enabled_keys_migration.py b/koku/reporting/migrations/0256_enabled_keys_migration.py new file mode 100644 index 0000000000..ee393592a0 --- /dev/null +++ b/koku/reporting/migrations/0256_enabled_keys_migration.py @@ -0,0 +1,83 @@ +# Generated by Django 3.2.13 on 2022-06-17 19:32 +from django.db import migrations +from django.db import models + + +class Migration(migrations.Migration): + + dependencies = [("reporting", "0255_ocp_label_indices")] + + operations = [ + migrations.RunSQL( + sql=""" +alter table reporting_azureenabledtagkeys + add column enabled boolean not null default true; +create index azure_enabled_covering_ix + on reporting_azureenabledtagkeys (key, enabled); + """, + reverse_sql=""" +drop index azure_enabled_covering_ix; +alter table reporting_azureenabledtagkeys + drop column enabled; + """, + state_operations=[ + migrations.AddField( + model_name="azureenabledtagkeys", + name="enabled", + field=models.BooleanField(default=True), + ), + migrations.AddIndex( + model_name="azureenabledtagkeys", + index=models.Index(fields=["key", "enabled"], name="azure_enabled_covering_ix"), + ), + ], + ), + migrations.RunSQL( + sql=""" +alter table reporting_gcpenabledtagkeys + add column enabled boolean not null default true; +create index gcp_enabled_covering_ix + on reporting_gcpenabledtagkeys (key, enabled); + """, + reverse_sql=""" +drop index gcp_enabled_covering_ix; +alter table reporting_gcpenabledtagkeys + drop column enabled; + """, + state_operations=[ + migrations.AddField( + model_name="gcpenabledtagkeys", + name="enabled", + field=models.BooleanField(default=True), + ), + migrations.AddIndex( + model_name="gcpenabledtagkeys", + index=models.Index(fields=["key", "enabled"], name="gcp_enabled_covering_ix"), + ), + ], + ), + migrations.RunSQL( + sql=""" +alter table reporting_ocpenabledtagkeys + add column enabled boolean not null default true; +create index ocp_enabled_covering_ix + on reporting_ocpenabledtagkeys (key, enabled); + """, + reverse_sql=""" +drop index ocp_enabled_covering_ix; +alter table reporting_ocpenabledtagkeys + drop column enabled; + """, + state_operations=[ + migrations.AddField( + model_name="ocpenabledtagkeys", + name="enabled", + field=models.BooleanField(default=True), + ), + migrations.AddIndex( + model_name="ocpenabledtagkeys", + index=models.Index(fields=["key", "enabled"], name="ocp_enabled_covering_ix"), + ), + ], + ), + ] diff --git a/koku/reporting/provider/azure/models.py b/koku/reporting/provider/azure/models.py index 0f9a75aa96..1d9113ef66 100644 --- a/koku/reporting/provider/azure/models.py +++ b/koku/reporting/provider/azure/models.py @@ -253,9 +253,11 @@ class Meta: """Meta for AzureEnabledTagKeys.""" db_table = "reporting_azureenabledtagkeys" + indexes = [models.Index(name="azure_enabled_covering_ix", fields=["key", "enabled"])] id = models.BigAutoField(primary_key=True) key = models.CharField(max_length=253, unique=True) + enabled = models.BooleanField(null=False, default=True) # ====================================================== diff --git a/koku/reporting/provider/gcp/models.py b/koku/reporting/provider/gcp/models.py index d932f0eff8..0308cc4d43 100644 --- a/koku/reporting/provider/gcp/models.py +++ b/koku/reporting/provider/gcp/models.py @@ -212,9 +212,11 @@ class Meta: """Meta for GCPEnabledTagKeys.""" db_table = "reporting_gcpenabledtagkeys" + indexes = [models.Index(name="gcp_enabled_covering_ix", fields=["key", "enabled"])] id = models.BigAutoField(primary_key=True) key = models.CharField(max_length=253, unique=True) + enabled = models.BooleanField(null=False, default=True) class GCPTagsSummary(models.Model): diff --git a/koku/reporting/provider/ocp/models.py b/koku/reporting/provider/ocp/models.py index 5d5af15089..1c80232caf 100644 --- a/koku/reporting/provider/ocp/models.py +++ b/koku/reporting/provider/ocp/models.py @@ -579,9 +579,11 @@ class Meta: """Meta for OCPEnabledTagKeys.""" db_table = "reporting_ocpenabledtagkeys" + indexes = [models.Index(name="ocp_enabled_covering_ix", fields=["key", "enabled"])] id = models.BigAutoField(primary_key=True) key = models.CharField(max_length=253, unique=True) + enabled = models.BooleanField(null=False, default=True) class OCPCluster(models.Model):