how to go about database migrations/upgrades

3 posts, 1 answers
  1. Erdem
    Erdem avatar
    22 posts
    Member since:
    Sep 2013

    Posted 18 May 2014 Link to this post


    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. Answer
    Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 22 May 2014 Link to this post

    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.

    Boris Georgiev
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
  3. DevCraft banner
  4. Erdem
    Erdem avatar
    22 posts
    Member since:
    Sep 2013

    Posted 24 May 2014 in reply to Boris Georgiev Link to this post

    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."
Back to Top