< Previous | Next >

Comparing and merging the changed physical data model with the original schema

In this exercise, you will use the compare editor to compare the modified physical data model with the database source of the model. If you had stored the data design project that contains the physical data model in one of the supported source code management tools, you would also have the option of comparing the local version of the physical data model with the stored version that is under source code control.

If you make changes to a model object in the compare editor, the changes are automatically added to the model. You must save the model to save the changes. You can also choose not to save the changes, and generate delta DDL statements instead.

In this exercise, you will make changes to a server object. If you make changes to a server object in the compare editor, you must generate delta DDL statements for the changes and deploy them to the server to save the changes.

Before you perform the comparison, you should refresh the database metadata in the Database Explorer, to ensure that you are working with the most current information. This step is important if you are working in a team environment, and other team members are making changes to the database.

To compare and merge the changed physical data model with the original schema:

  1. Right-click the sample [Derby V10.0] connection in the Database Explorer, and select Refresh.
  2. In the Data Project Explorer, right-click the SAMP schema in the sample_model.dbm file and select Compare With > Original Source. The compare editor opens.
  3. Double-click the Compare tab in the compare editor to maximize the compare editor view. When you compare data objects, the compare editor is customized to include a Structural Compare view and a Property Compare view. The physical data model is displayed on the left, and the original source from the database is displayed on the right. The columns at the top of the Structural Compare view display the name of each object.
  4. Expand the data objects in the Structural Compare view to see the changes that you made to the physical data model.
    Screen capture showing the Structural Compare view of the compare editor, as described.
  5. In the Structural Compare view, navigate through each difference. You can use the Go to Next Difference Go to Next Difference toolbar icon and Go to Previous Difference Go to Previous Difference toolbar icon toolbar buttons on the main toolbar to navigate or you can use the arrow keys on the keyboard.
  6. Merge the changes you made to the original database source by highlighting each difference and clicking the Copy from Left to Right Copy from Left to Right toolbar icon local toolbar button in the compare editor.

    You can verify which row is highlighted in the Structural Compare view by using the Property Compare view. You should see the properties for the highlighted object.

    You can also use the compare editor to merge changes from the database server to the physical data model, by clicking the Copy from Right to Left Copy from Right to Left toolbar icon local toolbar button.

  7. Optional: Find objects that might be impacted by your changes by clicking the Analyze Left Impact Analyze Left Impact toolbar icon or Analyze Right Impact Analyze Right Impact toolbar icon local toolbar buttons.

    Because you are making changes to the server object in this case, you must generate a DDL script to capture the changes that you made in the compare editor.

  8. Click the Generate Right DDL Generate Right DDL toolbar icon local toolbar button. This toolbar button is enabled only after you make changes to the right object in the compare editor. The Generate DDL wizard opens.
  9. On the Save and Run DDL page, specify the following settings:
    • Ensure that the EMPLOYEE data design project is specified in the Folder field.
    • Type mydeltaddl.sql in the File name field.
    • Select the Open DDL file for editing check box.
    • View the generated DDL statements in the Preview DDL field.
    If you wanted to run the DDL script on the server, you could select the Run DDL on server check box. If you select this option, you must provide connection information on the following pages of the wizard. Your settings should now look like this:
    Screen capture showing the wizard page settings as described in this step.
  10. Click Finish.
The mydeltaddl.sql file is created and displayed in the Data Project Explorer in the SQL Scripts folder. Because you selected to open the file for editing, the file also opens in the SQL editor, where you can modify the script.
Screen capture showing the SQL script open in the editor, as described.
< Previous | Next >