XPO - Automate Database Schema Migrations using the ORM Data Model Designer or APIs

XPO Team Blog
20 April 2020
We’ve got some good news for the majority of XPO and XAF users! With v20.1, you can incrementally update your database schema once changes are made to an XPO data model. You can generate diffs (the SQL script) between the latest data model and the existing database schema in the ORM Data Model Designer or in code. As always, we welcome your feedback. 

How it Works

In the Data Model Designer, right-click the design surface and select the Generate Migration Script menu item. The designer will add a new file with SQL commands and open it in Visual Studio.

If you create XPO classes manually, the following example demonstrates how to generate a schema migration script and update your database programmatically: How to Use the Database Schema Migrations API.

Supported Databases and Limitations

  • At present, the following data store providers support this feature: MSSqlConnectionProvider, MySqlConnectionProvider, OracleConnectionProvider, ODPConnectionProvider, ODPManagedConnectionProvider, PostgreSqlConnectionProvider.
  • The Database Schema Migration API may change prior to official release. Interfaces and method names are subject to change in the final release.
  • The Data Model Designer cannot generate a schema migration script if your Data Model contains classes imported from external assemblies. For instance, in XAF applications, the Base Class property can reference built-in business classes shipped with eXpressApp Framework (XAF). This scenario is not supported in our CTP version. You can still use API methods to generate a migration script in XAF apps.
  • The Data Model Designer does not allow you to specify custom schema migration options. 
  • If you rename a class or property, the schema migration script will delete the corresponding table or column and create a new one. 
  • The Data Model Designer cannot generate a database update script if the Data Model contains classes mapped to database views.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.