Hook Update Deploy Tools: Node import FAQs
Using the Drupal module Hook Update Deploy Tools to move node content can be an important part to a deployment strategy.
- How do I export and import nodes using Hook Update Deploy Tools? >> Read the project page or a quick how-to.
- What is the unique ID that connects an export to an import?
- What are the risks of this import export model?
- What if I am using an entity reference or a taxonomy that does not exist on production?
- Does the import show up as a revision?
- What happens if the import does not validate?
- What if the alias or path is already in use by another node?
- What if the alias or path is already in use by a View or used by a menu router?
- Is there a limit to the number of nodes that can be imported this way?
What is the unique ID that connects an export to an import?
To create the export file, the node id is used to create the file. After that, the filename and 'unique id' references the alias of that node. So when you import the node, the node id on the production site will be determined by looking up the alias of the node. If a matching alias is found, that is the node that gets updated. If no matching alias is found, a new node gets created. The alias becomes the unique id.
What are the risks of this import export model?
At present the known risks are:
- If the exported node uses entity references that do not exist on prod, the entity reference will either not be made, or reference an entity that is using that entity id on prod. This can be mitigated by exporting your source node while using a recent copy of the production DB.
- If the exported node uses taxonomy terms that do not exist on prod, the tag may import incorrectly. This can be mitigated by exporting your source node while using a recent copy of the production DB.
- if you are using pathato and the existing pattern on the production site is different than the pattern on your sandbox. The imported node will end up with a different alias, resulting in an invalid import. The imported node will be deleted since it failed validation and the hook_update_N will fail. This can be mitigated by exporting your source node while using a recent copy of the production DB.
- File attachments. There is currently not a way to bring attached files along with them unless the files already exist with a matching fid on production.
What if I am using an entity reference or a taxonomy that does not exist on production?
See answers 1 and 2 in What are the risks of this import export model?
Does the import show up as a revision?
Yes it does, and the revison note contains the imported note, but also indicates it was imported with Hook Update Deploy Tools. The revision will take on the status of the exported node. If the exported node was unpublished, the impoirted revision will be unpublished.
What happens if the import does not validate?
If the import was to an existing node, the update revision wil be deleted and return the node to its last published revision. If the import was for a node that did not exist on the site, the node and its first revision will be deleted. In either case, if the import was run through a hook_update_N, that update will fail and allow it to be re-run once the issue is resolved.
What if the alias or path is already in use by another node?
If the alias is in use by a node, that node will be updated by the import. The alias is the unique id that links them not the nid.
What if the alias or path is already in use by a View or used by a menu router?
If the alias is in use on the site by something other than a node, the import will be prevented. If the import is being run by a hook_update_N() then the update will fail and can be run when the issue is resolved.
Is there a limit to the number of nodes that can be imported this way?
Technically, there is no real limit. Realistically, it is not a great workflow to move all of your content this way. It is not a good workflow. This export import method is best reserved for mission critical pages like forms or thankyou pages that go along with a Feature deployment. It is also good for pages that often get destroyed during early site development like style guides and example pages.