@quereus/quereus 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,16 +7,16 @@ export function emitCreateAssertion(plan, _ctx) {
|
|
|
7
7
|
async function run(rctx) {
|
|
8
8
|
// Convert the CHECK expression to SQL text for storage
|
|
9
9
|
// The CHECK expression should be negated to become a violation query:
|
|
10
|
-
//
|
|
10
|
+
// check (condition) becomes "select 1 where not (condition)"
|
|
11
11
|
let violationSql;
|
|
12
12
|
try {
|
|
13
13
|
const exprSql = expressionToString(plan.checkExpression);
|
|
14
|
-
violationSql = `
|
|
14
|
+
violationSql = `select 1 where not (${exprSql})`;
|
|
15
15
|
}
|
|
16
16
|
catch (e) {
|
|
17
17
|
log('Failed to stringify assertion expression: %O', e);
|
|
18
18
|
// Fallback for complex expressions
|
|
19
|
-
violationSql = '
|
|
19
|
+
violationSql = 'select 1 where false'; // Never violates
|
|
20
20
|
}
|
|
21
21
|
// Create the assertion schema object
|
|
22
22
|
const assertionSchema = {
|