public void SetUp() { log = Substitute.For<IUpgradeLog>(); upgradeResult = null; scripts = new List<SqlScript> { new SqlScript("Script1.sql", "create table Foo (Id int identity)"), new SqlScript("Script2.sql", "alter table Foo add column Name varchar(255)"), new SqlScript("Script3.sql", "insert into Foo (Name) values ('test')") }; database = new TemporarySQLiteDatabase("IntegrationScenarios"); upgradeEngineBuilder = DeployChanges.To .SQLiteDatabase(database.SharedConnection) .WithScripts(new TestScriptProvider(scripts)) .LogTo(log); }
static void Main() { using (var database = new TemporarySQLiteDatabase("test")) { database.Create(); var upgrader = DeployChanges.To .SQLiteDatabase(database.SharedConnection) .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly()) .LogToConsole() .Build(); var watch = new Stopwatch(); watch.Start(); var result = upgrader.PerformUpgrade(); watch.Stop(); Display("File", result, watch.Elapsed); } // Database will be deleted at this point using (var database = new InMemorySQLiteDatabase()) { var upgrader = DeployChanges.To .SQLiteDatabase(database.ConnectionString) .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly()) .LogToConsole() .Build(); var watch = new Stopwatch(); watch.Start(); var result = upgrader.PerformUpgrade(); watch.Stop(); Display("InMemory", result, watch.Elapsed); } // Database will disappear from memory at this point }