11# Generated by Django 6.0.4 on 2026-06-10
22
33from django .db import migrations , models
4+ import dje .fields
45
56
67def purge_vulnerabilities (apps , schema_editor ):
@@ -10,6 +11,9 @@ def purge_vulnerabilities(apps, schema_editor):
1011
1112
1213class Migration (migrations .Migration ):
14+ # Non-atomic: the purge step cascades FK deletes which leave pending trigger
15+ # events that block subsequent ALTER TABLE in the same transaction.
16+ atomic = False
1317
1418 dependencies = [
1519 ("vulnerabilities" , "0007_vulnerability_vulnerabili_exploit_f83324_idx_and_more" ),
@@ -30,6 +34,8 @@ class Migration(migrations.Migration):
3034 model_name = "vulnerability" ,
3135 name = "vulnerability_id" ,
3236 ),
37+ # noop forward; backward: purge rows before re-adding NOT NULL vulnerability_id.
38+ migrations .RunPython (migrations .RunPython .noop , purge_vulnerabilities ),
3339 migrations .RemoveField (
3440 model_name = "vulnerability" ,
3541 name = "references" ,
@@ -52,11 +58,22 @@ class Migration(migrations.Migration):
5258 max_length = 200 ,
5359 ),
5460 ),
61+ migrations .AddField (
62+ model_name = 'vulnerability' ,
63+ name = 'ssvc_trees' ,
64+ field = dje .fields .JSONListField (
65+ blank = True , default = list , help_text = 'A list of SSVC decision trees for this vulnerability.'
66+ ),
67+ ),
5568 # Restore unique_together with the new advisory_uid field.
5669 migrations .AlterUniqueTogether (
5770 name = "vulnerability" ,
5871 unique_together = {("dataspace" , "uuid" ), ("dataspace" , "advisory_uid" )},
5972 ),
73+ migrations .AddIndex (
74+ model_name = "vulnerability" ,
75+ index = models .Index (fields = ['advisory_uid' ], name = 'vulnerabili_advisor_8c2f81_idx' ),
76+ ),
6077 migrations .AddIndex (
6178 model_name = "vulnerability" ,
6279 index = models .Index (fields = ["advisory_id" ], name = "vulnerabili_advisor_7de61b_idx" ),
0 commit comments