Skip to content

Commit f74520e

Browse files
authored
Merge pull request #13 from nexB/models_db
Creates models for the DB
2 parents cbe9125 + 5407e6e commit f74520e

1 file changed

Lines changed: 60 additions & 3 deletions

File tree

app/vulncode_app/models.py

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,63 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
1+
#
2+
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
3+
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4+
# The VulnerableCode software is licensed under the Apache License version 2.0.
5+
# Data generated with VulnerableCode require an acknowledgment.
6+
#
7+
# You may not use this software except in compliance with the License.
8+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software distributed
10+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
# specific language governing permissions and limitations under the License.
13+
#
14+
# When you publish or redistribute any data created with VulnerableCode or any VulnerableCode
15+
# derivative work, you must accompany this data with the following acknowledgment:
16+
#
17+
# Generated with VulnerableCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19+
# VulnerableCode should be considered or used as legal advice. Consult an Attorney
20+
# for any legal advice.
21+
# VulnerableCode is a free software code scanning tool from nexB Inc. and others.
22+
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
323

24+
from __future__ import unicode_literals
425
from django.db import models
526

6-
# Create your models here.
27+
28+
class Vulnerability(models.Model):
29+
vulnerability_id = models.AutoField(primary_key=True)
30+
summary = models.TextField(max_length=50)
31+
cvss = models.FloatField(max_length=50)
32+
33+
34+
class VulnerabilityReference(models.Model):
35+
vulnerability_id = models.ForeignKey('Vulnerability')
36+
source = models.CharField(max_length=50)
37+
reference_id = models.CharField(max_length=50)
38+
url = models.URLField(max_length=50)
39+
40+
41+
class ImpactedPackage(models.Model):
42+
vulnerability_id = models.ForeignKey('Vulnerability')
43+
package_id = models.ForeignKey('Package')
44+
45+
46+
class ResolvedPackage(models.Model):
47+
vulnerability_id = models.ForeignKey('Vulnerability')
48+
package_id = models.ForeignKey('Package')
49+
50+
51+
class Package(models.Model):
52+
package_id = models.AutoField(primary_key=True)
53+
platform = models.CharField(max_length=50)
54+
name = models.CharField(max_length=50)
55+
version = models.FloatField(max_length=50)
56+
57+
58+
class PackageReference(models.Model):
59+
package_id = models.ForeignKey('Package')
60+
repository = models.CharField(max_length=50)
61+
platform = models.CharField(max_length=50)
62+
name = models.CharField(max_length=50)
63+
version = models.FloatField(max_length=50)

0 commit comments

Comments
 (0)