public override IList <string> GenerateTSQL() { var steps = _wrappedStep.GenerateTSQL(); steps = ModifySteps(steps); return(steps); }
private bool OriginalStepHasCreateIndex(DeploymentStep originalStep) { var tsql = originalStep.GenerateTSQL(); foreach (var script in tsql) { if (IsCreateOrAlterIndex(script)) { return(true); } } return(true); }
private void Ignore(DeploymentPlanContributorContext context, string schemas) { var schemasList = schemas.Split(',').ToList(); DeploymentStep nextStep = context.PlanHandle.Head; var stepRemoved = false; while (nextStep != null) { stepRemoved = false; DeploymentStep currentStep = nextStep; if (currentStep is CreateElementStep scriptStep) { IList <string> scripts = currentStep.GenerateTSQL(); var parts = scriptStep.SourceElement.Name.Parts; if (parts.Count() > 0) { foreach (string script in scripts) { foreach (var schema in schemasList) { if (string.Equals(parts[0], schema, StringComparison.OrdinalIgnoreCase)) { nextStep = scriptStep.Next; // This is the step that removes the drop database step base.Remove(context.PlanHandle, scriptStep); stepRemoved = true; break; } } if (stepRemoved) { break; } } } if (stepRemoved) { continue; } } nextStep = currentStep.Next; } }
public override IList <string> GenerateTSQL() { var newScripts = new List <string>(); foreach (var script in _originalStep.GenerateTSQL()) { var replacement = GetReplacementScript(script); if (string.IsNullOrEmpty(replacement)) { newScripts.Add(script); } else { newScripts.Add(replacement); } } return(newScripts); }