Project

Profile

Help

Story #3953

closed

ContentUnitSaver should support creating content with related models inside its transaction

Added by jortel@redhat.com over 5 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
No
Tags:
Sprint:
Sprint 42
Quarter:

Description

Problem

DeclarativeVersion (stages) currently supports creating content consisting of a single Content model. Many plugins such as RPM and Docker have complex content models. That is, each content (unit) is stored in multiple tables. The insert into these tables needs be committed atomically to prevent storing incomplete content. Further, the inserts need to happen in relational (referential) order and be compatible with bulk_create().

Solution

Add a hook to ContentUnitSaver that will pass the batch of DeclarativeVersion objects to a method called save_related(batch). The base implementation of this will do nothing, but subclasses can perform bulk_save calls there. The call to save_related occurs after the content units have been saved, but during the same transaction.


Related issues

Blocks RPM Support - Issue #3952: Using the ErrataRelatedModelSaver can result in creating incomplete content.CLOSED - CURRENTRELEASEbmbouterActions

Also available in: Atom PDF