This is a migrated thread and some comments may be shown as answers.

how to go about database migrations/upgrades

2 Answers 43 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erdem
Top achievements
Rank 1
Erdem asked on 18 May 2014, 06:26 PM


Hi,

First off, I think Telerik Data Access is really easy and a nice solution. The model first approach works very well with many to many relationships etc.. and we still keep a nice visual interface.

I do have a question on database migrations though:

Situation: I want to create a local database in "Environment.SpecialFolder" and update it(with an extra column or table) whenever new changes happen to the database, when performing software upgrades.

What is the approach here?
I know I can select update database from model and choose if it should be create or edit database and it generates DDL script to run on the database.
But what would be the approach on a client pc? Do I have to code everything myself or is there some automated way that Telerik Data Access offers in order to initially create and upgrade the database when necessary ?

PS. I know it's a broad question but couldn't find much on this topic.

thank you,



2 Answers, 1 is accepted

Sort by
0
Accepted
Boris Georgiev
Telerik team
answered on 22 May 2014, 06:29 AM
Hello Erdem,

Apart from the "Update Database from Model" wizard you can also update the database in the runtime using the Telerik.OpenAccess.SchemaHandler class. With this class, Telerik Data Access provides an API for creating or migrating the database programmatically. The OpenAccessContext exposes a method named GetSchemaHandler() that returns the schema handling instance. Then with the schema handler, there are several methods you can use to easily update the schema. For more information you can refer to this article.

Please let me know if you need additional assistance or in case you have other questions.

Regards,
Boris Georgiev
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
Erdem
Top achievements
Rank 1
answered on 24 May 2014, 11:35 AM

Thanks for the response Boris,

this is quite impressive. It even creates a temp table when removing a column. I need to remember the following though:


" Please ensure that every class that you want a table to be generated for, has the property UpdateSchema set to true." http://www.telerik.com/forums/createupdateddlscript-returns-null-and-createddlscript-returns
Tags
Getting Started
Asked by
Erdem
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Erdem
Top achievements
Rank 1
Share this question
or