Skip to content

Commit

Permalink
use correct module uniqeness constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
furlongm committed Feb 5, 2024
1 parent cfeecd0 commit 9f59987
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
33 changes: 33 additions & 0 deletions modules/migrations/0002_auto_20240204_2214.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 3.2.23 on 2024-02-04 22:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('arch', '0001_initial'),
('modules', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='module',
name='context',
field=models.CharField(max_length=255),
),
migrations.AlterField(
model_name='module',
name='name',
field=models.CharField(max_length=255),
),
migrations.AlterField(
model_name='module',
name='stream',
field=models.CharField(max_length=255),
),
migrations.AlterUniqueTogether(
name='module',
unique_together={('name', 'stream', 'version', 'context', 'arch')},
),
]
7 changes: 4 additions & 3 deletions modules/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@

class Module(models.Model):

name = models.CharField(unique=True, max_length=255)
stream = models.CharField(unique=True, max_length=255)
name = models.CharField(max_length=255)
stream = models.CharField(max_length=255)
version = models.CharField(max_length=255)
context = models.CharField(unique=True, max_length=255)
context = models.CharField(max_length=255)
arch = models.ForeignKey(PackageArchitecture, on_delete=models.CASCADE)
repo = models.ForeignKey(Repository, on_delete=models.CASCADE)
packages = models.ManyToManyField(Package, blank=True)

class Meta:
verbose_name = 'Module'
verbose_name_plural = 'Modules'
unique_together = ('name', 'stream', 'version', 'context', 'arch',)
ordering = ('name',)

def __str__(self):
Expand Down

0 comments on commit 9f59987

Please sign in to comment.