Show TOC

Modifying a DatabaseLocate this document in the navigation structure

You can modify an existing database schema by to reflect changes in your model. The PDM (source model) and the existing database schema (target model) are merged using a database synchronization window, which allows you to choose which objects are added, deleted, or updated in the target.

Context

Note To update a HANA database, use the HANA wizard (see Exporting Objects to the HANA Repository).

Procedure

  1. Select Start of the navigation path Database Next navigation step Apply Model Changes to Database End of the navigation path


    Note To load a pre-configured settings set (see Quick Launch Selection and Settings Sets), select it in the list at the bottom of the dialog.
  2. Enter a destination Directory and File Name for the script file.
  3. Specify the type of generation (script or live database connection) to perform:
    • Script generation - generate a script to be executed on a DBMS at a later time. Optionally select One file only to create the generation script as a single file. By default, a separate script file is created for each table.

    • Direct generation – generate a script and execute it on a live database connection. Optionally select Edit generation script to open the script in an editor for review or editing before execution.

  4. Specify how PowerDesigner will determine the changes to apply. You can choose to compare your model against:
    • Archive model – Click the button to the right to browse to the archived model (see Archive PDMs).

    • Data source – Click the button to the right to connect to your data source.

    • Script file – Select a script from the list or click the button to the right to browse to the script.

    • Model from repository – Browse the repository from the list. You can optionally select a version earlier than the latest by clicking the button to the right.

  5. [optional] Select the following options as appropriate:

    Option

    Description

    Always use create statements/

    Use alter statements when possible

    Specify whether create statements should always be used to modify database tables, or whether alter statements should be used where possible.

    Backup tables

    Specifies that any existing table will be copied to a temporary backup during the modification, and then restored to the updated tables. If this option is not selected, then all existing data will be erased. If you select this option then you can also specify to :
    • Drop temporary tables - Specifies that the temporary backup tables are removed after script execution.
    • Use physical options for temporary tables - Specifies that the temporary backup tables are generated with their physical options.

    Check model

    Specifies that a model check is performed before script generation.

    Automatic archive

    Creates an archive version of the PDM after generation to use to determine changes during your next database modification (see Archive PDMs).

  6. [optional] To change the default generation options, click the Options tab (see Database Generation Dialog Options Tab).
  7. [optional] To change the format of your script, click the Format tab (see Database Generation Dialog Format Tab).
  8. [optional] To control which database objects will be modified, click the Selection tab.

    You can save your selection via the Selection bar at the bottom of the tab (see Quick Launch Selection and Settings Sets).

  9. Click OK to begin the update. If you are using a live database connection, then the Reverse Engineering window will open, allowing you to select or clear check boxes in the target model for objects that you want to include or remove from the source model. Make your selections and then click OK to continue.
  10. The Database Synchronization window will open. Select or clear check boxes in the target model for objects that you want to include or remove from the model, and then click OK to continue.

    For more information about comparing and merging models, see Core Features Guide > Modeling with PowerDesigner > Comparing and Merging Models.



    • If you are generating a script, a result box opens listing the file path of the generated file. To open the script in a text editor, select the file in the result box and click the Edit button.

    • If you are generating a database directly, a Data Source connection box is displayed. Type your connection details and click the Connect button. A message box shows the progress of the generation process. At the end of generation click OK to close the box.