Chapter 8. Forward Engineering a Data Model

A key design principle of Power*Architect is that the data models you create always remain generic. This allows you to use the same data model with a variety of database platforms. You can then use forward engineering to transform a data model for a specific database platform.

When you forward engineer a data model, Power*Architect creates a physical model that represents the idealized generic model as closely as possible, given the constraints of the target system. Power*Architect then creates a SQL Script that you can run to place the components of the data model into a database.

It is important to note that Power*Architect creates the structure of the target database only and does not create the actual database. Before using forward engineering, you must create the target database. You would typically do this using the administrative tools provided for the database platform.

Note: You can view or change the location of the forward engineering log file in user preferences. For more information, see the section called “Defining Project Settings” .

To forward engineer a data model:

  1. Open the Power*Architect project containing the data model you want to use. Ensure that all of the data model elements you want to forward engineer are included in the diagram in the playpen. Make any required changes, such as:

    • Creating new tables.

    • Renaming or deleting existing tables.

    • Creating new columns.

    • Renaming or deleting existing columns.

    • Moving columns between tables.

    • Modifying column data types.

    • Merging two or more tables together. (If the tables you merge have a parent-child relationship, this is called denormalizing the data model.)

    • Splitting a table into several related tables (this is often called normalization).

  2. Create the target database. You would typically do this using the administrative tools provided for the database platform.

  3. If necessary, create a connection for the target database. For more information, see Chapter 5, Setting up Database Support .

  4. Add the database connection to your project. For more information, see the section called “Adding or Removing Database Connections for a Project” .

  5. Click on the top toolbar, or select Tools » Forward Engineering. The Forward Engineer SQL Script dialog box appears.

  6. Enter the following information:

    In this field ...

    Do this ...

    Create in

    Select the database connection for the target database.

    Generate DDL for Database Type

    Select the database platform. This is the same database type you specified when you created the connection for the target database.

    All remaining fields (Catalog, Database, Schema, Owner, ...)

    Exactly which fields appear here depends on which target database platform you choose in the "Generate DDL for Database Type" field. Different database platforms organize tables in different hierarchies. You can experiment with choosing different target platform types to see which combinations exist.

    The names you enter here determine the qualifiers that will come before the names of the tables the script creates and alters.

    In any case, you can choose to leave these fields blank if you wish your create script to refer to tables (and other objects) by unqualified names.

  7. Click OK. Power*Architect generates a SQL script to create the data structure currently in the playpen.

    Note: As Power*Architect is generating the script, warnings or error reports may appear.

  8. The Preview SQL Script dialog box appears. For example:

  9. To run the script, click Execute. The database objects are created in the target database.