[PATCH v2] models: Use database constraints to prevent split Series

Petr Vorel petr.vorel at gmail.com
Fri Oct 18 10:12:03 AEDT 2019

Hi Stephen,

> Currently, the 'SeriesReference' object has a unique constraint on the
> two fields it has, 'series', which is a foreign key to 'Series', and
> 'msgid'. This is the wrong constraint. What we actually want to enforce
> is that a patch, cover letter or comment is referenced by a single
> series, or rather a single series per project the submission appears on.
> As such, we should be enforcing uniqueness on the msgid and the project
> that the patch, cover letter or comment belongs to.

> This requires adding a new field to the object, 'project', since it's
> not possible to do something like the following:

>   unique_together = [('msgid', 'series__project')]

> This is detailed here [1]. In addition, the migration needs a precursor
> migration step to merge any broken series.

> [1] https://stackoverflow.com/a/4440189/613428

> Signed-off-by: Stephen Finucane <stephen at that.guru>
> Closes: #241
> Cc: Daniel Axtens <dja at axtens.net>
> Cc: Petr Vorel <petr.vorel at gmail.com>

I cannot review your patch, but thanks a lot for implementing fix for #241.

Something related (I should create GH issue): it'd be great if cover letter was
always displayed (no matter how, but with all replies). ATM it's displayed as a
separate patch, if there is diff included: series [1], separated cover letter
[2] (there is no series).

Kind regards,

[1] https://patchwork.ozlabs.org/project/ltp/list/?series=135548&state=*
[2] https://patchwork.ozlabs.org/patch/1175082/

More information about the Patchwork mailing list