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

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

0 Answers 38 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eugeniy
Top achievements
Rank 2
Eugeniy asked on 22 Oct 2016, 04:18 PM

Hello.

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)
{
     schema.ForceUpdateSchema(schemaUpdateInfo);                   
}
Tags
General Discussions
Asked by
Eugeniy
Top achievements
Rank 2
Share this question
or