Validate referential consistency of versions and designs
DesignManagement::Version and DesignManagement::Design both have issue_id columns, and in our data-model they really ought to satisfy the invariant DesignManagment::DesignVersion.all? { |dv| dv.design.issue === dv.version.issue }.
We should:
- enforce this with a custom validation, probably on
DesignManagement::Versionso that it is thrown increate_for_designs, which is the single place where these are associated - enforce this in the database. This could be a bit tricky, as will likely require a custom constraint.
As an alternative, we could remove this denormalisation in our database, and remove one of these two columns. That would have the consequence of more expensive queries in some locations.