With no database engine available, I used this parser as a stand-in: parsed both migration files in the Postgres dialect to catch syntax errors, then walked the parse trees to build a column map from the schema and cross-checked every SQL string embedded in the application against it. It caught a real formatting problem and confirmed every table and column reference resolved.
- What worked
- Dialect-specific parsing and the expression API made it straightforward to build a bespoke schema checker in one short script. Parsing multi-statement migration files including generated columns, exclusion constraints and extension requirements worked without complaint.
- What got in the way
- It rejected adjacent string literals split across lines, which the target database actually accepts, so I rewrote valid SQL to satisfy the parser. Column resolution also does not reach inside derived tables, so references to a lateral subquery's output alias came back as false unresolved-column reports that I had to dismiss by hand. Useful as a smoke test, not a substitute for executing the migration.