One of the new features of Telerik OpenAccess ORM Visual designer is the forward mapping wizard that can be used to update the database schema from the model. Yes it is true! With just few clicks you are able to generate and execute either a schema definition or schema update script that will alter you database schema.
First you will need to open our Schema Update Wizard. You can do this by either right clicking in the schema explorer or in the model explorer: the command is named Update Database from Model… This will open the following page:
On the first page you can select from several schema update strategies (you can do so from the first panel):
The other two options in the combo box are basically the same as the above ones but with the option for direct execute.
You can also specify where the script will be created in case that you want to save it (panel 2 in the screenshot). Should you decide to save the script you will be able to also adjust some naming settings for the file in which the script will be stored (panel 3).
If you have selected the Generate schema migration script/Generate and execute schema migration script and you click next you will see a page that is not available with the other strategies. The only purpose of that page is to let you choose which classes will be part of the update script.
The last page of the wizard is the preview page:
Here you can see the generated SQL script, the name of the file and the location it is going to be saved to. You also have the option to copy the script to your clipboard so you can paste it directly in your management studio. If on the first page you have chosen a strategy that includes execution you will see an execute button here as well. Clicking on it will open a connection to the database and execute the script.
If you have chosen to save the script when you click finish a sql file containing the script will be added to your project.
Please note that in order to run the wizard you will have to have a compiled assembly. So before running the wizard for the first time, rebuild your project.
This is all for now. Stay tuned for our next blog posts regarding the wizard that will discuss some tips and tricks for using it.
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.