Skip to content

Commit cda5531

Browse files
committed
Migration Script
Signed-off-by: 404-geek <[email protected]>
1 parent b8e6090 commit cda5531

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Generated by Django 5.1.11 on 2025-07-13 20:01
2+
3+
import django.db.models.deletion
4+
import uuid
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('scanpipe', '0073_add_sha1_git_checksum'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='codebaseresource',
17+
name='sha1_git',
18+
field=models.CharField(blank=True, help_text='SHA1 checksum generated by Git, hex-encoded.', max_length=40, verbose_name='SHA1_git'),
19+
),
20+
migrations.CreateModel(
21+
name='DiscoveredPackageScore',
22+
fields=[
23+
('scoring_tool', models.CharField(blank=True, choices=[('ossf-scorecard', 'Ossf'), ('others', 'Others')], help_text='Defines the source of a score or any other scoring metricsFor example: ossf-scorecard for scorecard data', max_length=100)),
24+
('scoring_tool_version', models.CharField(blank=True, help_text='Defines the version of the scoring tool used for scanning thepackageFor Eg : 4.6 current version of OSSF - scorecard', max_length=50)),
25+
('score', models.CharField(blank=True, help_text='Score of the package which is scanned', max_length=50)),
26+
('scoring_tool_documentation_url', models.CharField(blank=True, help_text='Documentation URL of the scoring tool used', max_length=100)),
27+
('score_date', models.DateTimeField(blank=True, editable=False, help_text='Date when the scoring was calculated on the package', null=True)),
28+
('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='UUID')),
29+
('discovered_package', models.ForeignKey(editable=False, help_text='The package for which the score is given', on_delete=django.db.models.deletion.CASCADE, related_name='scores', to='scanpipe.discoveredpackage')),
30+
],
31+
options={
32+
'verbose_name': 'discovered package score',
33+
'verbose_name_plural': 'discovered package scores',
34+
'ordering': ['-score'],
35+
},
36+
),
37+
migrations.CreateModel(
38+
name='ScorecardCheck',
39+
fields=[
40+
('check_name', models.CharField(blank=True, help_text='Defines the name of check corresponding to the OSSF scoreFor example: Code-Review or CII-Best-PracticesThese are the some of the checks which are performed on a scanned package', max_length=100)),
41+
('check_score', models.CharField(blank=True, help_text='Defines the score of the check for the package scannedFor Eg : 9 is a score given for Code-Review', max_length=50)),
42+
('reason', models.CharField(blank=True, help_text='Gives a reason why a score was given for a specific checkFor eg, : Found 9/10 approved changesets -- score normalized to 9', max_length=300)),
43+
('details', models.JSONField(blank=True, default=list, help_text='A list of details/errors regarding the score')),
44+
('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='UUID')),
45+
('package_score', models.ForeignKey(editable=False, help_text='The checks for which the score is given', on_delete=django.db.models.deletion.CASCADE, related_name='checks', to='scanpipe.discoveredpackagescore')),
46+
],
47+
options={
48+
'verbose_name': 'scorecard check',
49+
'verbose_name_plural': 'scorecard checks',
50+
'ordering': ['-check_score'],
51+
},
52+
),
53+
migrations.AddIndex(
54+
model_name='discoveredpackagescore',
55+
index=models.Index(fields=['score'], name='scanpipe_di_score_078964_idx'),
56+
),
57+
migrations.AddIndex(
58+
model_name='discoveredpackagescore',
59+
index=models.Index(fields=['scoring_tool_version'], name='scanpipe_di_scoring_7fa482_idx'),
60+
),
61+
migrations.AddIndex(
62+
model_name='scorecardcheck',
63+
index=models.Index(fields=['check_score'], name='scanpipe_sc_check_s_e189f7_idx'),
64+
),
65+
migrations.AddIndex(
66+
model_name='scorecardcheck',
67+
index=models.Index(fields=['check_name'], name='scanpipe_sc_check_n_1df2b1_idx'),
68+
),
69+
]

0 commit comments

Comments
 (0)