This script can be used to merge the content of two RDMO instances. More precice, It allows the ingest of a secondary RDMO instance into a primary instance, while keeping all foreign key relations intact and adding content elements which do not exist in the primary instance, yet.
The merge.py
scripts needs Python3 without additional packages. It works on fixtures created from the instances. Both instance need to be updated to the latest version of RDMO. In particular, all database migrations need to be performed.
-
Please create additonal backups of all relevant data, this is a rather complicated process. Things can go wrong.
-
Create fixture dumps for both instances. Remember the instances need to be fully upgraded to the latest version. The following commands need to be executed in the
rdmo-app
directory of the primary and secondary instance.(env) ~/rdmo-primary$ ./manage.py dumpdata > primary.json (env) ~/rdmo-secondary$ ./manage.py dumpdata > secondary.json
-
Run
merge.py
with the two dumps:(env) ~/rdmo-merge$ ./merge.py primary.json secondary.json output.json
Warnings are created when an element of secodary is found in primary, but has a different value. This can happen if the element was changed whithout changing the URI.
-
Load the created fixture into the primary instance:
(env) ~/rdmo-primary$ ./manage.py loaddata output.json