Models answer their own dependencies.View.Reads(schema), Routine.References(schema), Column.References(schema), CheckConstraint.References(schema), and Trigger.References(schema) (its function reference plus its scanned body and WHEN predicate).
SqlLexer: one lexical layer for engine SQL. A public, tolerant scanner over the amorphous “SQL grammar” — nestable block comments, '…' strings, "…" and […] identifiers with doubling escapes, etc.
Changed
The whole migration is linearized from the dependency graph. Action ordering is a priority-respecting topological sort: every create runs after what it requires and every drop before what requires it.
Fixed
Multi-statement bodies round-trip. A routine definition or view body may now be written as a single dollar-quoted block ($$ … $$), the same quoting triggers and scripts already use, and import writes that form whenever the bare text would not re-parse. A T-SQL body’s top-level ; previously ended the statement early, so an imported SQL Server routine could not be read back.
Trailing line comments no longer swallow what follows.import guards a routine definition or argument list that ends in a -- comment, which previously commented out the closing ) or ; the writer printed on the same line.