
trgr:triggers-change-modules-database( $old-db as xs:anyAtomicType, $new-db as xs:anyAtomicType ) as empty-sequence()
Any Trigger with a module referring to $old-db will be updated to refer to $new-db. This is useful after restoring a Trigger's database to a different cluster with different database IDs than the one from which it was backed up.
| Parameters | |
|---|---|
| old-db | The old database ID or name. |
| new-db | The new database ID or name. |
xquery version "1.0-ml";
(: run this against your triggers database :)
import module namespace trgr = "http://marklogic.com/xdmp/triggers"
at "/MarkLogic/triggers.xqy";
trgr:triggers-change-modules-database(xdmp:database("Triggers"), xdmp:database("Modules"))
=> Empty sequence. All triggers referencing the "Triggers" database by name
or by ID will have their modules database set to reference the ID of
the Modules database.
trgr:triggers-change-modules-database("Triggers", "Modules")
=> Empty sequence. All triggers referencing the "Triggers" database by name or id
( meaning Triggers with a module referencing the ID of Triggers database will be affected too)
as their modules database will be changed to reference the Modules database.