File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
PowerSync/PowerSync.Common/DB/Schema Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,16 @@ public class Schema(Dictionary<string, Table> tables)
99
1010 public void Validate ( )
1111 {
12- foreach ( var table in Tables . Values )
12+ foreach ( var kvp in Tables )
1313 {
14+ var tableName = kvp . Key ;
15+ var table = kvp . Value ;
16+
17+ if ( Table . InvalidSQLCharacters . IsMatch ( tableName ) )
18+ {
19+ throw new Exception ( $ "Invalid characters in table name: { tableName } ") ;
20+ }
21+
1422 table . Validate ( ) ;
1523 }
1624 }
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public class TableOptions(
2020
2121public class Table
2222{
23- private static readonly Regex InvalidSQLCharacters = new Regex ( @"[""'%,.#\s\[\]]" , RegexOptions . Compiled ) ;
23+ public static readonly Regex InvalidSQLCharacters = new Regex ( @"[""'%,.#\s\[\]]" , RegexOptions . Compiled ) ;
2424
2525
2626 protected TableOptions Options { get ; init ; } = null ! ;
You can’t perform that action at this time.
0 commit comments