Updating model from database

Update From Database Wizard allows you to update the model from the database quickly and conveniently. Manual changes to the model are preserved where possible.

The wizard detects all database changes that can affect the model, for example, created and deleted tables and views, their columns and foreign keys, column data type changes, created and deleted stored procedures and functions, and changes to their parameters.

To update the model from the database:

1. Right-click the empty space in the diagram area and select Update Model From Database from the shortcut menu. The first page of Update From Database Wizard is displayed.

Update a model from a database

2. Select the Recreate Model checkbox, if necessary, to clear the model and create it anew without deleting and re-adding the model file.

3. Click Next. The Choose schemas page of the wizard is displayed.

Choose schemas

4. Select schemas to be compared with the model and click Next. The Choose change actions page of the wizard is displayed.

Choose change actions

5. Select the Group by schemas checkbox to group changed database objects by schemas, if necessary.

6. Select database objects and separate changes to be synchronized. If you choose not to apply changes to some column or constraint, Entity Developer will remember it and will not offer to apply changes to this object next time – in the Choose Actions tree, the object will be deselected by default. Each node of the object tree that corresponds to a database object available for update has a remark describing the action raised between this object and the corresponding model entity. The following types of actions are available:

  • Added – The object is not present in the model. It will be added to the model after the wizard finishes.

  • Dropped – The object is not present in the database. It will be dropped from the model after the wizard finishes.

  • Changed – Some properties of this object differ from the corresponding database object fields. The model object property set will be changed.

  • Renamed – objects in the database and in the model have different names. This type of change is not always detected automatically during the comparison of database metadata and metadata built from the model. For renamed objects to be detected, they must conform to certain rules. Metadata comparison is implemented in two steps. In the first step, equivalents are looked for with exactly the same number of columns and foreign keys, with the columns matching as well. If no equivalents are found, then similar objects are looked for using the same rules, but columns must match only by name. When identical objects are found, similar objects will not be looked for. Objects not detected as renamed automatically are displayed as a pair of dropped/created objects. Select such a pair, right-click the selection, and choose Resolve Renamed from the shortcut menu to mark the objects as renamed. To cancel renaming, right-click the object marked as Renamed and select Cancel Renaming.

Right-click the root nodes to open the shortcut menu and check or uncheck all added, dropped, or changed objects.

7. Click Next.

8. On the final page of the wizard, click Finish.

The database and the model are now synchronized.

See also

  • Updating database from model