Object lifecycle
Last updated
Last updated
Purpose of SQL Tran is to cover everything when migrating code - all the way to ensuring all the required objects are created in the target database and thoroughly tested.
Object's source (DDL script) is parsed to validate that its syntax is correct. We are transforming plain SQL source text into strongly-typed rich internal tree object structure.
Static analysis in SQL Tran is used to track references over the whole codebase, building a lineage. This is extremely helpful to fine-tune the generated target code by understanding relationships and uncovering intent.
In this step the source SQL is transformed into the syntactically valid and equivalent target database code. The generated code is idiomatic to the target database engine and built in the way human would write it to ensure that the target code stays maintainable.
You can override automated translation for each object by deciding to manually rewrite either source or target script.
Objects can also be marked ignored if you want to keep them out of the target database or simply cleaning up unused code. This can break references in objects relying on newly ignored object but SQL Tran detects the broken state and correctly updates the status of all objects database-wide.
The only way to really know if generated code is acceptable to the specific target database is to actually execute its creation statement. That way we either get the server confirmation that the object was correctly created - or that it failed (in which case we will note and expose the error),
After creating the translated object in the target database, all we know for sure is that there are no syntax errors. Actually, for some databases even that isn't guaranteed. For example, PostgreSQL keeps the body of the procedure in a string. You will be able to create the object but will get a runtime error executing it if it has a syntax error. We need to run the translated code to know that it work. And, we need to compare the side-effects of running it on source and target to be certain that the logic of the source and translated target code does the same thing. We built a full-fledged testing framework for that purpose.