From 05007d03ee82470533b0a7e4de1eb41ec21f5c35 Mon Sep 17 00:00:00 2001 From: Pepe Fagoaga Date: Wed, 26 Feb 2025 21:17:16 +0545 Subject: [PATCH] fix(findings): change `uid` from varchar to text (#7048) --- api/CHANGELOG.md | 1 + .../api/migrations/0012_alter_finding_uid.py | 17 +++++++++++++++++ api/src/backend/api/models.py | 2 +- api/src/backend/api/specs/v1.yaml | 3 +-- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 api/src/backend/api/migrations/0012_alter_finding_uid.py diff --git a/api/CHANGELOG.md b/api/CHANGELOG.md index 27c89043a8..7b638bb70e 100644 --- a/api/CHANGELOG.md +++ b/api/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to the **Prowler API** are documented in this file. ### Changed - Optimized `GET /findings` endpoint to improve response time and size [(#7019)](https://github.com/prowler-cloud/prowler/pull/7019). +- Changed `findings.uid` field type from `varchar(300)` to `text` [(#7048)](https://github.com/prowler-cloud/prowler/pull/7048). --- diff --git a/api/src/backend/api/migrations/0012_alter_finding_uid.py b/api/src/backend/api/migrations/0012_alter_finding_uid.py new file mode 100644 index 0000000000..a0465ec5f9 --- /dev/null +++ b/api/src/backend/api/migrations/0012_alter_finding_uid.py @@ -0,0 +1,17 @@ +# Generated by Django 5.1.5 on 2025-02-26 13:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("api", "0011_findings_performance_indexes_parent"), + ] + + operations = [ + migrations.AlterField( + model_name="finding", + name="uid", + field=models.TextField(blank=False, null=False), + ), + ] diff --git a/api/src/backend/api/models.py b/api/src/backend/api/models.py index b407603814..f60ad26d3c 100644 --- a/api/src/backend/api/models.py +++ b/api/src/backend/api/models.py @@ -636,7 +636,7 @@ class Finding(PostgresPartitionedModel, RowLevelSecurityProtectedModel): updated_at = models.DateTimeField(auto_now=True, editable=False) first_seen_at = models.DateTimeField(editable=False, null=True) - uid = models.CharField(max_length=300) + uid = models.TextField(blank=False, null=False) delta = FindingDeltaEnumField( choices=DeltaChoices.choices, blank=True, diff --git a/api/src/backend/api/specs/v1.yaml b/api/src/backend/api/specs/v1.yaml index c2fdccdedf..3bf25cc20b 100644 --- a/api/src/backend/api/specs/v1.yaml +++ b/api/src/backend/api/specs/v1.yaml @@ -5834,7 +5834,7 @@ components: properties: uid: type: string - maxLength: 300 + nullable: false delta: enum: - new @@ -5893,7 +5893,6 @@ components: readOnly: true nullable: true required: - - uid - status - severity - check_id