From 2f43f874183ae3ec48ced4144c22b6aa9bfb00b2 Mon Sep 17 00:00:00 2001 From: Jordi Gil Date: Wed, 6 May 2026 15:27:00 -0400 Subject: [PATCH] [COST-7249] Widen rates_to_usage.label_hash to VARCHAR(64) Extend label_hash from VARCHAR(32) (MD5) to VARCHAR(64) in preparation for Phase 3's SHA-256 upgrade. This is a backwards- compatible schema change with zero runtime impact on existing MD5 hashes. Split out from Phase 3 PR #6043 per TL request so that Phase 3 remains a clean git-revert without migration entanglement. Co-authored-by: Cursor --- .../0350_widen_ratestousage_label_hash.py | 15 +++++++++++++++ koku/reporting/provider/ocp/models.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 koku/reporting/migrations/0350_widen_ratestousage_label_hash.py diff --git a/koku/reporting/migrations/0350_widen_ratestousage_label_hash.py b/koku/reporting/migrations/0350_widen_ratestousage_label_hash.py new file mode 100644 index 0000000000..3621a29dc8 --- /dev/null +++ b/koku/reporting/migrations/0350_widen_ratestousage_label_hash.py @@ -0,0 +1,15 @@ +from django.db import migrations +from django.db import models + + +class Migration(migrations.Migration): + + dependencies = [("reporting", "0349_ratestousage_composite_index")] + + operations = [ + migrations.AlterField( + model_name="ratestousage", + name="label_hash", + field=models.CharField(max_length=64, null=True), + ), + ] diff --git a/koku/reporting/provider/ocp/models.py b/koku/reporting/provider/ocp/models.py index 06cd7763b4..3922abb227 100644 --- a/koku/reporting/provider/ocp/models.py +++ b/koku/reporting/provider/ocp/models.py @@ -1085,7 +1085,7 @@ class Meta: distributed_cost = models.DecimalField(max_digits=33, decimal_places=15, null=True) cost_category = models.ForeignKey("OpenshiftCostCategory", on_delete=models.CASCADE, null=True) labels = JSONField(null=True) - label_hash = models.CharField(max_length=32, null=True) + label_hash = models.CharField(max_length=64, null=True) # Import on-prem line item models so Django can discover them for migrations