Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class DataHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
var dbContext = ApplicationContext.Current.DatabaseContext;
var dbs = new DatabaseSchemaHelper(dbContext.Database, ApplicationContext.Current.ProfilingLogger.Logger, dbContext.SqlSyntax);
dbs.DropTable<ActorMovie>();
dbs.DropTable<Actor>();
dbs.DropTable<Movie>();
dbs.DropTable<Director>();
if (!dbs.TableExist<ActorMovie>)
{
dbs.CreateTable<Director>();
dbs.CreateTable<Movie>();
dbs.CreateTable<Actor>();
dbs.CreateTable<ActorMovie>();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.