Creating SQL triggers to override HCL Commerce database table triggers

If you need to override the SQL database table triggers that are provided for HCL Commerce database tables, you can create your own custom triggers to override the default triggers.

About this task

To create your own SQL triggers for provided HCL Commerce database tables, you must drop the existing database triggers and then create your triggers. The SQL to drop and create the triggers for the database tables must be added to the following files:
  • utilities_root/schema/9.0.0.0/dbtype/wcs.stage.trigger.sql
  • utilities_root/schema/9.0.0.0/dbtype/wcs.droptrigger.sql
Where dbtype is db2.

These files contain the SQL triggers for the database tables that are provided with HCL Commerce. The stagingcopy utility and the stagingprop utility can run these files to drop and create or re-create triggers.

Attention: Any custom triggers that you create for database tables that are provided with HCL Commerce can be overwritten when you apply maintenance fixes or upgrade HCL Commerce

Procedure

  1. Open the Utility server Docker container.
  2. Go to the directory that includes the SQL database triggers for the tables that are provided with HCL Commerce
    If you are creating custom triggers for a database table that is provided with HCL Commerce, go to the following directory:
    • utilities_root/schema/9.0.0.0/dbtype
  3. Open the SQL trigger files that you want to update for editing. Update the SQL to define your custom database triggers.
  4. DB2 As an administrator with access to your database, manually run the corresponding drop trigger file.
  5. Manually run the staging trigger script to create or re-create the database table triggers to use your custom triggers.