Story #3953

Updated by bmbouter about 3 years ago

h2. 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().

h2. Solution

We need a hook to ContentUnitSaver that will pass the batch common solution for plugin writers. This may be a combination of functionality provided by django and DeclarativeVersion objects to a method called <code>save_related(batch)</code>. 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. _(stages)_.