Declare which table components apply where. ShouldApplyExpression evaluates per target database; one table file carries every environment variant with no branching pipeline.
ShouldApplyExpression is the universal opt-in/opt-out switch on every component that supports it.
Dev uses synthetic data and a lean index set. Staging mirrors production's footprint. Production carries the full reporting stack and the regulated columns. Without a declarative answer, those differences turn into per-environment file copies, branching pipelines, or hand-maintained deploy scripts — the kind of drift that's fine until a column gets forgotten. ShouldApplyExpression is that declarative answer: a SQL fragment attached to a component that decides, at deployment time, whether the component should apply to the current target.
The same property is available on:
The expression is a SQL fragment that returns a single scalar value. When SchemaQuench evaluates it before deploying that component, it considers the result false if it's 0, the literal string false, or empty/null. Anything else means apply the component normally.
Tokens inside the expression — {{Table.Environment}} in the example below — are substituted through the Script Tokens system before the expression runs. See Script token mechanics for the token sources, substitution rules, and case-insensitive matching behavior.
A reporting index that should only materialize in production, scoped by an Extensions-driven Custom Property:
{
"Name": "[Orders]",
"Extensions": { "Environment": "Production" },
"Indexes": [
{
"Name": "[IX_Orders_Reporting]",
"IndexColumns": "[ReportingDate]",
"ShouldApplyExpression": "SELECT CASE WHEN '{{Table.Environment}}' = 'Production' THEN 1 ELSE 0 END"
}
]
}
The Orders table declares a table-level Custom Property Extensions.Environment set to Production. The IX_Orders_Reporting index's ShouldApplyExpression reads that property through {{Table.Environment}} at deployment. The expression returns 1 on every target where the property resolves to Production, so the index applies there and is skipped everywhere else — one index definition, one table file, no per-environment forks.
A ShouldApplyExpression evaluates against metadata your team defines. Custom Properties are the mechanism: an open Extensions object on every schema object where you attach environment labels, data-classification tags, ownership markers, retention policies, or any other team-defined metadata. Those values become {{TokenName}} substitutions inside ShouldApplyExpression and every other expression field SchemaQuench evaluates.
Combined with Custom Properties and the rest of the Script Tokens feature surface, ShouldApplyExpression lets you express deployment-time decisions declaratively without ever writing a separate per-environment script file. See Custom Properties for the Extensions carrier shape, token promotion rules (bare names at table scope, Table. prefix from child components), and nested-object flattening.
Last reviewed May 2026 by the SchemaSmith Team.