dimanche 26 avril 2015

SQL Migration scripts from EDMX

I'm using DB-first approach. On every deployment I need to upgrade my the production DB with the new columns or changes to the existing columns.

I was looking at ways to generate a generic SQL script according to the EDMX the problem is that all script generation\ migration capabilities of Entity-Framework are for Code-First approach

Is there a way to create a SQL Script that would follow the following logic:

  1. if table not exist create the table (with no columns) if column X

  2. in table Y not exist add the column

    • if column exist check if types are the same if not alter the type (i know this can cause problems i'm still thinking on how to tackle that)
  3. if foreign key not exist create.

  4. if foreign key exist but should not drop it

any suggestion ?

Aucun commentaire:

Enregistrer un commentaire