Commit c44c2eaf authored by Chris Lamb's avatar Chris Lamb 💬

Add explicit missing on_delete to foreign keys, required for Django 2.x

parent a3846f20
...@@ -8,7 +8,9 @@ from django.utils.crypto import get_random_string ...@@ -8,7 +8,9 @@ from django.utils.crypto import get_random_string
class Submission(models.Model): class Submission(models.Model):
buildinfo = models.ForeignKey( buildinfo = models.ForeignKey(
'buildinfo.Buildinfo', related_name='submissions' 'buildinfo.Buildinfo',
related_name='submissions',
on_delete=models.CASCADE,
) )
slug = models.CharField( slug = models.CharField(
...@@ -19,7 +21,9 @@ class Submission(models.Model): ...@@ -19,7 +21,9 @@ class Submission(models.Model):
max_length=8, max_length=8,
) )
key = models.ForeignKey('keys.Key', related_name='submissions') key = models.ForeignKey(
'keys.Key', related_name='submissions', on_delete=models.CASCADE
)
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=datetime.datetime.utcnow)
......
...@@ -7,18 +7,26 @@ from django.urls import reverse ...@@ -7,18 +7,26 @@ from django.urls import reverse
class Buildinfo(models.Model): class Buildinfo(models.Model):
sha1 = models.CharField(max_length=40, unique=True) sha1 = models.CharField(max_length=40, unique=True)
source = models.ForeignKey('packages.Source', related_name='buildinfos') source = models.ForeignKey(
'packages.Source', related_name='buildinfos', on_delete=models.CASCADE
)
architecture = models.ForeignKey( architecture = models.ForeignKey(
'packages.Architecture', related_name='buildinfos' 'packages.Architecture',
related_name='buildinfos',
on_delete=models.CASCADE,
) )
version = models.CharField(max_length=200) version = models.CharField(max_length=200)
build_path = models.CharField(max_length=512) build_path = models.CharField(max_length=512)
build_date = models.DateTimeField(null=True) build_date = models.DateTimeField(null=True)
build_origin = models.ForeignKey('Origin', null=True) build_origin = models.ForeignKey(
'Origin', null=True, on_delete=models.CASCADE
)
build_architecture = models.ForeignKey( build_architecture = models.ForeignKey(
'packages.Architecture', related_name='buildinfos_build' 'packages.Architecture',
related_name='buildinfos_build',
on_delete=models.CASCADE,
) )
environment = models.TextField() environment = models.TextField()
...@@ -58,10 +66,14 @@ class Buildinfo(models.Model): ...@@ -58,10 +66,14 @@ class Buildinfo(models.Model):
class Binary(models.Model): class Binary(models.Model):
buildinfo = models.ForeignKey(Buildinfo, related_name='binaries') buildinfo = models.ForeignKey(
Buildinfo, related_name='binaries', on_delete=models.CASCADE
)
binary = models.ForeignKey( binary = models.ForeignKey(
'packages.Binary', related_name='generated_binaries' 'packages.Binary',
related_name='generated_binaries',
on_delete=models.CASCADE,
) )
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=datetime.datetime.utcnow)
...@@ -81,7 +93,9 @@ class Checksum(models.Model): ...@@ -81,7 +93,9 @@ class Checksum(models.Model):
Binary, etc. Binary, etc.
""" """
buildinfo = models.ForeignKey(Buildinfo, related_name='checksums') buildinfo = models.ForeignKey(
Buildinfo, related_name='checksums', on_delete=models.CASCADE
)
filename = models.CharField(max_length=255) filename = models.CharField(max_length=255)
size = models.IntegerField() size = models.IntegerField()
...@@ -90,7 +104,9 @@ class Checksum(models.Model): ...@@ -90,7 +104,9 @@ class Checksum(models.Model):
checksum_sha1 = models.CharField(max_length=100) checksum_sha1 = models.CharField(max_length=100)
checksum_sha256 = models.CharField(max_length=100) checksum_sha256 = models.CharField(max_length=100)
binary = models.OneToOneField(Binary, null=True, related_name='checksum') binary = models.OneToOneField(
Binary, null=True, related_name='checksum', on_delete=models.CASCADE
)
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=datetime.datetime.utcnow)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment