[PATCH] models: Use database constraints to prevent split Series
stephen at that.guru
Thu Oct 17 03:58:08 AEDT 2019
On Wed, 2019-10-16 at 13:06 +0100, Stephen Finucane wrote:
> 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 forgot to include the changes to 'patchwork.parser' here. Will respin
More information about the Patchwork