Reverse Engineering

Top  Previous  Next

Reverse Engineering refers to the process of reading information about your existing database from the system catalog and creating a new Model based on them.  This is a good place to start using the product if you already have a database.

How to Reverse Engineer a new Model:

1.Select Database > Reverse Engineer from the menu, or select from the Database toolbar, or select from the Database Tasks section of the Shortcut Toolbar to start the Reverse Engineer wizard.  If you have a Model open, ModelRight will close it before starting the Reverse Engineer process.  If the Model has any unsaved changes, ModelRight will prompt you to save them.

2.

 

Enter the connection information for the database that you want to Reverse Engineer, and click on Next.  ModelRight uses native drivers so there is no need to fuss with ODBC drivers.

3.In the next page, define the database objects that you want to import.

You can filter the database objects that you import in a number of ways:

You can filter any type of object by Name by entering a comma separated list of filters.  These filters are used to form a LIKE conditions in the query statement that ModelRight uses to retrieve database objects.  If a Name filter term starts with a "!", then a "NOT LIKE" condition will be used for that term.  In the screenshot above, the Table Name filter specifies that only Tables starting with "EMP" or "JOB" will be imported.

Filter By Schema: if you select this option, then only objects from the selected database Schemas will be imported.

Filter By Tablespace:  select this option if you want to import Table and Materialized Views based on the Tablespace they are in.

Include Referenced Objects:  if this option is selected, then if an object that is being imported references an object that is not selected for import, that referenced object will also be imported.  i.e. if a Table you are importing has a Column that is a foreign key from another table that is not being imported, then that parent Table will also be imported - or if you chose not to import Tablespaces, and this option is selected, then ModelRight will automatically import Tablespaces that are used by the Tables that are imported.

4.The Instance Filter page lets you further specify the database objects that you want to RE or Compare.  The database objects that are displayed here are based on the filters that were specified on the previous wizard page:

If you Reverse Engineer into an existing Model, then a Show Objects Already in Model option is displayed to let you show or hide existing objects.  This makes it easier for you to see what exists in the Database, but not in your Model.

5.The next screen displays just for your information - and to let you cancel the RE if you want.  If you do hit Cancel, keep in mind that the first Cancel stops the RE, and the second Cancel will Cancel the dialog.  Hitting Finish will Commit the RE process.

 

6.When the RE process has completed (either into a New Model or the existing Model), this dialog is displayed to give you a summary of what was imported.  This dialog also contains options for inferring additional info and auto-layout of the Diagram.   If your database already has key constraint and referential constraints already specified, then ModelRight will have already imported this information and you you will not need to select the infer option.

 

7. If you elected to Infer Keys and Relations, then this dialog is displayed to let you specify the constraint information that you want to automatically create.

Make Unique Indexes Unique Keys - select this option if your database does not contain Unique Key Constraints, but does contain Unique Indexes that you want to associate with a Unique Constraint.

Make Smallest Unique Key the Primary Key - if your database does not have Primary Keys or if you selected to infer Unique Keys, then select this option to infer a Primary Key.  ModelRight will select the smallest Unique Key.  If there is more than one, ModelRight 4.1 will select the one that who's  first column has the most similarity to the Table name.

From Indexes and Column Names - If an Index in a Child Table has Columns that match the names and datatypes of a Key Constraint in the Parent Table, then a relation is created.

From Column Names and Datatypes - If a Child Table has Columns that match the names and datatypes of a Key Constraint in the Parent Table, then a relation is created.

 

If you Reverse Engineer into an the existing Model, then Infer will only be applied to the newly added Tables.

 

8.If you elected to Auto-Layout Imported Tables, then this dialog is displayed to let you specify the relative distance between Tables.  The Compaction Factor must be a number between 1 and 100.  The time that Auto-Layout and Diagram display of your new Model takes depends on how large your new Model is and how many relations it contains.

If you Reverse Engineer into an existing Model, then only the newly imported Tables will be used.  At the end of the layout they will be auto-selected so that you can move them as a group.