[PATCH v2 2/5] toaster: Add recipe variable snapshot model

Paolo Wattebled <[email protected]>
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <[email protected]>
Add one compressed variable snapshot per build and recipe. Store the
entry count separately so recipe list queries do not need to decompress
each snapshot.

AI-Generated: Uses GitHub Copilot and OpenCode with GPT-5.6 Sol
Signed-off-by: Paolo Wattebled <[email protected]>
---
 .../orm/migrations/0022_recipevariable.py     | 27 +++++++++++++++++++
 lib/toaster/orm/models.py                     | 10 +++++++
 2 files changed, 37 insertions(+)
 create mode 100644 lib/toaster/orm/migrations/0022_recipevariable.py

diff --git a/lib/toaster/orm/migrations/0022_recipevariable.py b/lib/toaster/orm/migrations/0022_recipevariable.py
new file mode 100644
index 000000000..455a8ce23
--- /dev/null
+++ b/lib/toaster/orm/migrations/0022_recipevariable.py
@@ -0,0 +1,27 @@
+# Generated by Django 4.2.5 on 2026-08-11 00:00
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('orm', '0021_eventlogsimports'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='RecipeVariable',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('variables', models.BinaryField()),
+                ('variable_count', models.PositiveIntegerField(default=0)),
+                ('build', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='orm.build')),
+                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='orm.recipe')),
+            ],
+            options={
+                'unique_together': {('build', 'recipe')},
+            },
+        ),
+    ]
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index e2f488ed8..c240836cc 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -1346,6 +1346,16 @@ class Recipe(models.Model):
         unique_together = (("layer_version", "file_path", "pathflags"), )
 
 
+class RecipeVariable(models.Model):
+    build = models.ForeignKey(Build, on_delete=models.CASCADE)
+    recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
+    variables = models.BinaryField()
+    variable_count = models.PositiveIntegerField(default=0)
+
+    class Meta:
+        unique_together = (("build", "recipe"), )
+
+
 class Recipe_DependencyManager(models.Manager):
     use_for_related_fields = True
 
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.