Script Reverse Engineering

PowerDesigner can reverse engineer SQL scripts into a PDM. The statements that control script generation are available in the Script/Objects category.

When reverse-engineering a SQL script into a PDM, PowerDesigner compares each statement in turn with all of the Create statements defined in the DBMS definition file and when it finds a match, extracts all of the available information to create or update PDM objects.

The statements used in script reverse engineering are the same as those for script generation (see Script Generation).

For example, in Sybase IQ v15.2, the Create statement in the Table category is the following:
create[%ExtGlobalTemporaryTable%? global temporary] table [%QUALIFIER%]%TABLE% (
   %TABLDEFN%
)[.Z:[[%R%?[.O:[in][on]] %DBSpace%:[%DBSpace%?
   in %DBSpaceGeneratedName%]]][
   on commit %OnCommit%][%NotTransactional%? not transactional][
   at %.q:At%][%R%?partition by range %RevPartition%:[%PartitionKey%?[%hasLifecycle%?:
   partition by range (%PartitionKey.Code%)
   (
      %PartitionDef%
   )]]]
]

This statement contains the parameters for creating the table together with its owner and physical options using variables (see Variables for Tables and Views) that extract the necessary information from the object's properties.

If you are using the extension mechanism for script generation, you have to declare statements in the list item ReversedStatements (one statement per line) for them to be properly reversed.

For example, the extension statement AfterCreate uses CreatePartition, which must be declared in ReversedStatements to be properly reverse engineered: