Database migration (how to check if table will be created)

Thread is closed for posting
1 posts, 0 answers
  1. Eugeniy
    Eugeniy avatar
    63 posts
    Member since:
    Feb 2011

    Posted 22 Oct 2016 Link to this post


    I have added parent table to existing child table with existing data. I want all current data from child table to be deleted during automatic database update.

    Here is the code ( SchemeUpdateInfo.NewTables does not exist, it's just for an example of what I want to do ):

    var schemaUpdateInfo = schema.CreateUpdateInfo(new SchemaUpdateProperties() );
    // Here I want to check if parent table was absent
    //Like this: if( schemeUpdateInfo.NewTables.Contains("ParentTable")){ db.ChildTable.DeleteAllOnSubmit(db.ChildTable);}
    if (schemaUpdateInfo.HasScript)
Back to Top