[PATCH v2] models: Use database constraints to prevent split Series
petr.vorel at gmail.com
Fri Oct 18 10:12:03 AEDT 2019
> 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 . In addition, the migration needs a precursor
> migration step to merge any broken series.
>  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 , separated cover letter
 (there is no series).
More information about the Patchwork