protected override void ProcessRecord() { base.ProcessRecord(); var infoTextWriter = new LambdaTextWriter(WriteVerbose); List<ChangeScript> allChangeScripts = new DirectoryScanner(infoTextWriter, Encoding.UTF8, new DirectoryInfo(this.deltasDirectory)) .GetChangeScripts(); var repository = new ChangeScriptRepository(allChangeScripts); var changeScripts = repository.GetAvailableChangeScripts(); DbmsFactory factory = new DbmsFactory(this.DatabaseType, this.ConnectionString); var queryExecuter = new QueryExecuter(factory); var schemaManager = new DatabaseSchemaVersionManager(queryExecuter, factory.CreateDbmsSyntax(), this.TableName); var appliedChanges = schemaManager.GetAppliedChanges(); var notAppliedChangeScripts = changeScripts.Where(c => appliedChanges.All(a => a.ScriptNumber != c.ScriptNumber)); var descriptionPrettyPrinter = new DescriptionPrettyPrinter(); var objects = notAppliedChangeScripts .Select(script => new { Id = script.ScriptNumber, Description = descriptionPrettyPrinter.Format(script.ScriptName), File = script.FileInfo }); this.WriteObject(objects, true); }
protected override void ProcessRecord() { base.ProcessRecord(); var infoTextWriter = new LambdaTextWriter(WriteVerbose); List <ChangeScript> allChangeScripts = new DirectoryScanner(infoTextWriter, Encoding.UTF8) .GetChangeScriptsForDirectory(new DirectoryInfo(this.deltasDirectory)); var repository = new ChangeScriptRepository(allChangeScripts); var changeScripts = repository.GetAvailableChangeScripts(); DbmsFactory factory = new DbmsFactory(this.DatabaseType, this.ConnectionString); var queryExecuter = new QueryExecuter(factory); var schemaManager = new DatabaseSchemaVersionManager(queryExecuter, factory.CreateDbmsSyntax(), this.TableName, true); var appliedChanges = schemaManager.GetAppliedChanges(); var notAppliedChangeScripts = changeScripts.Where(c => appliedChanges.All(a => a.ScriptNumber != c.ScriptNumber)); var descriptionPrettyPrinter = new DescriptionPrettyPrinter(); var objects = notAppliedChangeScripts .Select(script => new { Id = script.ScriptNumber, Description = descriptionPrettyPrinter.Format(script.ScriptName), File = script.FileInfo }); this.WriteObject(objects, true); }
protected override void ProcessRecord() { base.ProcessRecord(); var infoTextWriter = new LambdaTextWriter(WriteVerbose); List<ChangeScript> allChangeScripts = new DirectoryScanner(infoTextWriter).GetChangeScriptsForDirectory(new DirectoryInfo(_deltasDirectory)); var repository = new ChangeScriptRepository(allChangeScripts); var changeScripts = repository.GetOrderedListOfDoChangeScripts(); var appliedChangeNumbers = _databaseSchemaVersion.GetAppliedChangeNumbers(); var notAppliedChangeScripts = changeScripts.Where(c => !appliedChangeNumbers.Contains(c.GetId())); var descriptionPrettyPrinter = new DescriptionPrettyPrinter(); var objects = notAppliedChangeScripts .Select(script => new { Id = script.GetId(), Description = descriptionPrettyPrinter.Format(script.GetDescription()), File = script.GetFile() }); WriteObject(objects, true); }
public void NumberShouldBeSplitFromDescription() { Assert.AreEqual("001 - Description", prettyPrinter.Format("001_Description")); }