File tree Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -461,6 +461,7 @@ export class ExpressionTransformer<Schema extends SchemaDef> {
461461 if ( isBeforeInvocation ( expr . receiver ) ) {
462462 // policy handler creates a join table named `$before` using entity value before update,
463463 // we can directly reference the column from there
464+ invariant ( context . operation === 'post-update' , 'before() can only be used in post-update policy' ) ;
464465 invariant ( expr . members . length === 1 , 'before() can only be followed by a scalar field access' ) ;
465466 return ReferenceNode . create ( ColumnNode . create ( expr . members [ 0 ] ! ) , TableNode . create ( '$before' ) ) ;
466467 }
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import type {
1414
1515export class ExpressionVisitor {
1616 visit ( expr : Expression ) : void {
17- return match ( expr )
17+ match ( expr )
1818 . with ( { kind : 'literal' } , ( e ) => this . visitLiteral ( e ) )
1919 . with ( { kind : 'array' } , ( e ) => this . visitArray ( e ) )
2020 . with ( { kind : 'field' } , ( e ) => this . visitField ( e ) )
You can’t perform that action at this time.
0 commit comments