private void RunMigration(string localDbPath, string[] tablesToIgnoreOrAppend, string targetConnectionString, Scope scope, bool removeTempFiles) { using (var repository = new DB4Repository($"Data Source={localDbPath};Max Database Size=4000")) { var scriptRoot = Path.GetTempFileName(); var tempScript = scriptRoot + ".sqltb"; var generator = new Generator4(repository, tempScript); if (scope == Scope.DataOnlyForSqlServerIgnoreIdentity) { //Ignore all tables except the ones in tablesToAppend var tables = repository.GetAllTableNames(); var list = tables.Except(tablesToIgnoreOrAppend.ToList()); generator.ExcludeTables(list.ToList()); } else { generator.ExcludeTables(tablesToIgnoreOrAppend.ToList()); } generator.ScriptDatabaseToFile(scope); using (var serverRepository = new ServerDBRepository4(targetConnectionString)) { try { //Handles large exports also... if (File.Exists(tempScript)) // Single file { serverRepository.ExecuteSqlFile(tempScript); if (removeTempFiles) { TryDeleteFile(tempScript); } } else // possibly multiple files - tmp2BB9.tmp_0.sqlce { for (var i = 0; i < 400; i++) { var testFile = string.Format("{0}_{1}{2}", scriptRoot, i.ToString("D4"), ".sqltb"); if (File.Exists(testFile)) { serverRepository.ExecuteSqlFile(testFile); if (removeTempFiles) { TryDeleteFile(testFile); } } } } } catch (Exception ex) { CreateBlockFile(localDbPath, ex); throw; } } } }
public void TestGraphSortServer() { using (IRepository sourceRepository = new ServerDBRepository4(serverConnectionString)) { var generator = new Generator4(sourceRepository, @"C:\temp\testAMS40.sqlce"); generator.ExcludeTables(new System.Collections.Generic.List <String>()); } }
public void TestGraphSortComplex() { using (IRepository sourceRepository = new DB4Repository(sdfConnectionString2)) { var generator = new Generator4(sourceRepository, @"C:\temp\testPZ.sqlce"); generator.ExcludeTables(new System.Collections.Generic.List <String>()); } }
public void TestServerExportDotInTable() { string path = @"C:\temp\API2012.sqlce"; using (IRepository sourceRepository = new ServerDBRepository4(serverApiTestConnectionString)) { var generator = new Generator4(sourceRepository, path); generator.ExcludeTables(new List<string>()); } }
public void TestServerHierarchyIdSqlCe() { using (IRepository sourceRepository = new ServerDBRepository4(serverHIDConnectionString)) { var exclusions = new List <string>(); var generator = new Generator4(sourceRepository, @"C:\code\test2.sql"); generator.ExcludeTables(exclusions); generator.ScriptDatabaseToFile(Scope.SchemaData); } }
public void TestServerExportConstrainsIssue() { string path = @"C:\temp\Baseball.sqlce"; using (IRepository sourceRepository = new ServerDBRepository4(BaseballTestConnectionString)) { var generator = new Generator4(sourceRepository, path); generator.ExcludeTables(new List <string>()); } }
public void TestServerExportDotInTable() { string path = @"C:\temp\API2012.sqlce"; using (IRepository sourceRepository = new ServerDBRepository4(serverApiTestConnectionString)) { var generator = new Generator4(sourceRepository, path); generator.ExcludeTables(new List <string>()); } }
public void TestExportToSqlServer2() { var path = @"C:\temp\testum.sql"; using (var sourceRepository = new DB4Repository(umbracoConn)) { var generator = new Generator4(sourceRepository, path, false, false, false); generator.ExcludeTables(new List <string>()); generator.ScriptDatabaseToFile(Scope.SchemaData); } }
public void TestServerExportToSqlite() { var path = @"C:\temp\testAW2012.sql"; using (var sourceRepository = new ServerDBRepository4(serverDefConnectionString, true)) { var generator = new Generator4(sourceRepository, path, false, false, true); generator.ExcludeTables(new List <string>()); generator.ScriptDatabaseToFile(Scope.SchemaDataSQLite); } }
public void TestServerExportUniqueIssue() { string path = @"C:\temp\E2E.sqlce"; using (IRepository sourceRepository = new ServerDBRepository4(E2EConnectionString)) { var generator = new Generator4(sourceRepository, path); generator.ExcludeTables(new List <string>()); generator.GenerateTableScript("OneToOneSeparateFKDependent"); var test = generator.GeneratedScript; } }
public void TestServerExportUniqueIssue() { string path = @"C:\temp\E2E.sqlce"; using (IRepository sourceRepository = new ServerDBRepository4(E2EConnectionString)) { var generator = new Generator4(sourceRepository, path); generator.ExcludeTables(new List<string>()); generator.GenerateTableScript("OneToOneSeparateFKDependent"); var test = generator.GeneratedScript; } }
public void TestServerExportConstrainsIssue() { string path = @"C:\temp\Baseball.sqlce"; using (IRepository sourceRepository = new ServerDBRepository4(BaseballTestConnectionString)) { var generator = new Generator4(sourceRepository, path); generator.ExcludeTables(new List<string>()); } }
public void TestGraphSortServer() { using (IRepository sourceRepository = new ServerDBRepository4(serverConnectionString)) { var generator = new Generator4(sourceRepository, @"C:\temp\testAMS40.sqlce"); generator.ExcludeTables(new System.Collections.Generic.List<String>()); } }
public void TestGraphSortComplex() { using (IRepository sourceRepository = new DB4Repository(sdfConnectionString2)) { var generator = new Generator4(sourceRepository, @"C:\temp\testPZ.sqlce"); generator.ExcludeTables(new System.Collections.Generic.List<String>()); } }
public void TestServerHierarchyIdSqlCe() { using (IRepository sourceRepository = new ServerDBRepository4(serverHIDConnectionString)) { var exclusions = new List<string>(); var generator = new Generator4(sourceRepository, @"C:\code\test2.sql"); generator.ExcludeTables(exclusions); generator.ScriptDatabaseToFile(Scope.SchemaData); } }