public static void GetScriptsToRun(IDBUpdaterUserInteractionContext view) { var runned = new List <string>(); var version = 0; var files = new List <string>(Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath), "*.sql")); using (var c = new SqlCommand("select * from sysDBVersion", view.Connection)) { using (var r = c.ExecuteReader()) { while (r.Read()) { version = Math.Max(r.GetInt32(0), version); runned.Add(r.GetString(1)); } } } for (int i = 0; i < files.Count; i++) { files[i] = Path.GetFileNameWithoutExtension(files[i]); } foreach (var r in runned) { var ind = files.FindIndex(sc => sc.EndsWith(r)); if (ind >= 0) { files.RemoveAt(ind); } } view.AsyncSetScripts(runned, files); }
public static void GetScriptsToRun(IDBUpdaterUserInteractionContext view) { var runned = new List<string>(); var version = 0; var files = new List<string>(Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath), "*.sql")); using (var c = new SqlCommand("select * from sysDBVersion", view.Connection)) { using (var r = c.ExecuteReader()) { while (r.Read()) { version = Math.Max(r.GetInt32(0), version); runned.Add(r.GetString(1)); } } } for (int i = 0; i < files.Count; i++) { files[i] = Path.GetFileNameWithoutExtension(files[i]); } foreach (var r in runned) { var ind = files.FindIndex(sc => sc.EndsWith(r)); if (ind >= 0) { files.RemoveAt(ind); } } view.AsyncSetScripts(runned, files); }