Skip to content

Commit 3a4d60f

Browse files
committed
rename Benchmark.benchmark_type to source, add Result.suite_version
Repurpose the cryptic C/O codes as full-text 'legacy'/'pyperformance' values. Migration remaps all existing rows to 'legacy'. Result.suite_version (blank default) records which version of the benchmark suite produced each measurement. Remove the clean() constraint that tied default_on_comparison to benchmark_type. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ec49688 commit 3a4d60f

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from django.db import migrations, models
2+
3+
4+
def remap_benchmark_type(apps, schema_editor):
5+
Benchmark = apps.get_model('codespeed', 'Benchmark')
6+
Benchmark.objects.all().update(source='legacy')
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
dependencies = [
12+
('codespeed', '0004_branch_display_on_comparison_page'),
13+
]
14+
15+
operations = [
16+
migrations.RenameField(
17+
model_name='benchmark',
18+
old_name='benchmark_type',
19+
new_name='source',
20+
),
21+
migrations.RunPython(remap_benchmark_type, migrations.RunPython.noop),
22+
migrations.AlterField(
23+
model_name='benchmark',
24+
name='source',
25+
field=models.CharField(
26+
choices=[('legacy', 'Legacy'), ('pyperformance', 'PyPerformance')],
27+
default='legacy',
28+
max_length=14,
29+
),
30+
),
31+
migrations.AddField(
32+
model_name='result',
33+
name='suite_version',
34+
field=models.CharField(blank=True, default='', max_length=50),
35+
),
36+
]

0 commit comments

Comments
 (0)