public void LoadSchema() { Console.WriteLine("Loading schema"); using (var manager = new TransactionManager(_migrationsServer)) { Console.WriteLine("Creating base"); RunScript(DirectoryManager.GetFileCreateDatabase()); Console.WriteLine("Creating methods"); RunScript(DirectoryManager.GetFileCreateMethods()); Console.WriteLine("Populating schema changes"); RunScript(DirectoryManager.GetFileSchemaChanges()); manager.CommitTransaction(); } }
public void ScriptCreateDatabase() { Console.WriteLine("Scripting database schema {0}", _database.Name); DirectoryManager.EnsureDirectoryBaseExists(); var watch = new Stopwatch(); watch.Start(); var baseUrns = GetBaseUrns(); ScriptBase(baseUrns); PostScriptProcessor processor; Console.WriteLine("Done with base {0}", watch.Elapsed.TotalSeconds); var methodUrns = GetMethodUrns(); Console.WriteLine("Done making dependency list {0}", watch.Elapsed.TotalSeconds); var methodsName = DirectoryManager.GetFileCreateMethods(); if (File.Exists(methodsName)) { File.Delete(methodsName); } if (methodUrns.Count() == 0) { Console.WriteLine("No methods to script"); } else { var ordered = WalkMethodDependencies(baseUrns, methodUrns); Console.WriteLine("Done walking dependency list {0}", watch.Elapsed.TotalSeconds); ScriptMethods(methodsName, ordered); Console.WriteLine("Done scripting methods {0}", watch.Elapsed.TotalSeconds); } ScriptDataToFile(DirectoryManager.GetFileSchemaChanges(), "SchemaChanges"); }