Skip to content

PreparedTrigger_MaintainParentMinimum

github-actions[bot] edited this page Dec 4, 2026 · 3 revisions

PreparedTrigger_MaintainParentMinimum

Use PreparedTrigger_MaintainParentMinimum<TSource, TParent> on a dated child entity to maintain a nullable decimal minimum on its parent. Specify the decimal value, the foreign key to the parent ID, the stored UTC DateOnly date, and the target with the same SQL precision and scale. Return the prepared trigger from the child's getDatabaseTriggers(). For a child table written through the Entity API, set UseSqlOutputClause = false on its [Entity] attribute.

The rule uses three SQL triggers named by appending _Insert, _Update, and _Delete to the supplied name. When a row moves, both parents are recalculated. Null values are ignored and the stored minimum becomes null when the window contains no non-null values. Use days: 30, includeToday: false to count the dates from 29 days ago through yesterday. The first installation recalculates existing parents. The passage of time alone does not run this trigger.

Entity triggers and common imports

Clone this wiki locally