File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -952,6 +952,23 @@ fn custom_handlers(node: &Node) -> TokenStream {
952952 }
953953 }
954954 } ,
955+ "TruncateStmt" => quote ! {
956+ tokens. push( TokenProperty :: from( Token :: Truncate ) ) ;
957+ if n. restart_seqs {
958+ tokens. push( TokenProperty :: from( Token :: Restart ) ) ;
959+ tokens. push( TokenProperty :: from( Token :: IdentityP ) ) ;
960+ } else {
961+ tokens. push( TokenProperty :: from( Token :: ContinueP ) ) ;
962+ tokens. push( TokenProperty :: from( Token :: IdentityP ) ) ;
963+ }
964+ match n. behavior {
965+ // DropRestrict
966+ 1 => tokens. push( TokenProperty :: from( Token :: Restrict ) ) ,
967+ // DropCascade
968+ 2 => tokens. push( TokenProperty :: from( Token :: Cascade ) ) ,
969+ _ => { }
970+ }
971+ } ,
955972 _ => quote ! { } ,
956973 }
957974}
Original file line number Diff line number Diff line change @@ -358,4 +358,18 @@ mod tests {
358358 ] ,
359359 )
360360 }
361+
362+ #[ test]
363+ fn test_truncate ( ) {
364+ test_get_node_properties (
365+ "TRUNCATE TABLE users CONTINUE IDENTITY RESTRICT" ,
366+ SyntaxKind :: TruncateStmt ,
367+ vec ! [
368+ TokenProperty :: from( SyntaxKind :: Truncate ) ,
369+ TokenProperty :: from( SyntaxKind :: ContinueP ) ,
370+ TokenProperty :: from( SyntaxKind :: IdentityP ) ,
371+ TokenProperty :: from( SyntaxKind :: Restrict ) ,
372+ ] ,
373+ )
374+ }
361375}
You can’t perform that action at this time.
0 commit comments