mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
rrs: fix unique constraint on RecipeMaintainerHistory sha1 field
Although it's unlikely to be an issue, technically we shouldn't be insisting the sha1 field be unique globally, just within each layerbranch, so adjust the constraints. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
50f7c7036a
commit
32617fc366
25
rrs/migrations/0018_rmh_unique.py
Normal file
25
rrs/migrations/0018_rmh_unique.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.12 on 2018-04-18 05:42
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('layerindex', '0013_patch'),
|
||||||
|
('rrs', '0017_maintenanceplan_maintainer_style'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recipemaintainerhistory',
|
||||||
|
name='sha1',
|
||||||
|
field=models.CharField(max_length=64),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='recipemaintainerhistory',
|
||||||
|
unique_together=set([('layerbranch', 'sha1')]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -225,9 +225,12 @@ class RecipeMaintainerHistory(models.Model):
|
||||||
title = models.CharField(max_length=255, blank=True)
|
title = models.CharField(max_length=255, blank=True)
|
||||||
date = models.DateTimeField(db_index=True)
|
date = models.DateTimeField(db_index=True)
|
||||||
author = models.ForeignKey(Maintainer)
|
author = models.ForeignKey(Maintainer)
|
||||||
sha1 = models.CharField(max_length=64, unique=True)
|
sha1 = models.CharField(max_length=64)
|
||||||
layerbranch = models.ForeignKey(LayerBranch)
|
layerbranch = models.ForeignKey(LayerBranch)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ('layerbranch', 'sha1',)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_last(layerbranch):
|
def get_last(layerbranch):
|
||||||
rmh_qry = RecipeMaintainerHistory.objects.filter(layerbranch=layerbranch).order_by('-date')
|
rmh_qry = RecipeMaintainerHistory.objects.filter(layerbranch=layerbranch).order_by('-date')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user