Reverse Engineering from Scripts

PowerDesigner can reverse engineer a PDM for one or more SQL script files. The script will normally be the script used to generate the database but can also include other scripts.

Warning!  In general, only statements that create objects are reverse-engineered and alter statements, except for those that add columns to a table, are not supported.
  1. To reverse engineer a script into an existing PDM, select Database > Update Model from Database.

    or

    To reverse engineer a script and create a new PDM, select File > Reverse Engineer > Database to open the New Physical Data Model dialog. Specify a model name, choose a DBMS from the list, and then click OK.

    or

    When working with the PowerDesigner Eclipse plug-in, select any SQL file in the Navigator, right-click it and select Reverse Engineer from SQL File. You are given the option to reverse into an existing or new PDM.

    Note: To reverse-engineer an MS Access database, you must first prepare a .dat file (see Reverse Engineering a Microsoft Access Database).
  2. When the Database Reverse Engineering Options dialog opens, select Using script files:


    The following tools are provided to help with script selection:

    Tool

    Description



    Add Files – Opens a dialog box to allow you to browse for scripts files. You can add as many files as necessary.



    Move Up – Moves the selected file(s) up one row. This tool is grayed if the selected file(s) are at the top of the list.



    Move Down - Moves the selected file(s) down one row. This tool is grayed if the selected file(s) are at the bottom of the list.



    Clear All - Deletes all files from the list.

    Note: You can add as many script files as necessary to the list. If you are reversing more than one script file, the order in which the files are reversed must respect any dependencies among objects (for example, trigger creation scripts must come after table creation scripts, and grant permission scripts must come after both table and user creation scripts.
  3. [optional] Click the Options tab to specify any reverse engineering options (see Reverse Engineering Options Tab).
    Note: References and primary keys are not rebuilt by default. To enable rebuilding, select the appropriate options on the Options tab.
  4. [optional] Click the Target Models tab to specify any external shortcuts (see Reverse Engineering Target Models Tab).
  5. Click OK to begin reverse engineering.

    If you are reverse engineering to an existing PDM, then the Merge Models dialog box opens to allow you to control the merging of the new objects into your PDM (see Core Features Guide > Modeling with PowerDesigner > Comparing and Merging Models). When the process is complete, a confirmation message is given in the Output window.