Loading TOC...

trgr:triggers-change-modules-database

trgr:triggers-change-modules-database(
   $old-db as xs:unsignedLong,
   $new-db as xs:unsignedLong
) as empty-sequence()

Summary

This function changes the trigger definitions of each trigger definition in the database that has the database ID $old-db and replaces each database ID with $new-db. This is useful after restoring a triggers database to a different cluster that has different database IDs than the one from which it was backed up.

Parameters
$old-db The old database ID.
$new-db The new database ID.

Example

xquery version "1.0-ml"; 

(: run this against you triggers database :) 
import module namespace trgr = "http://marklogic.com/xdmp/triggers" 
      at "/MarkLogic/triggers.xqy";

trgr:triggers-change-modules-database(5184170867299910410, 
      xdmp:database("Modules") )
      
=> Empty sequence. Sets all triggers that reference 5184170867299910410
    as their modules database to reference the ID of the Modules database.
    

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.