diff --git a/src/DbUp.Console/DbUp.Console.v2.ncrunchproject b/src/DbUp.Console/DbUp.Console.v2.ncrunchproject
new file mode 100644
index 00000000..8641d361
--- /dev/null
+++ b/src/DbUp.Console/DbUp.Console.v2.ncrunchproject
@@ -0,0 +1,19 @@
+
+ false
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ true
+ 60000
+
+
+ AutoDetect
+
\ No newline at end of file
diff --git a/src/DbUp.Firebird/DbUp.Firebird.v2.ncrunchproject b/src/DbUp.Firebird/DbUp.Firebird.v2.ncrunchproject
new file mode 100644
index 00000000..cdfbdeb6
Binary files /dev/null and b/src/DbUp.Firebird/DbUp.Firebird.v2.ncrunchproject differ
diff --git a/src/DbUp.MySql/DbUp.MySql.csproj b/src/DbUp.MySql/DbUp.MySql.csproj
index 3cee6217..5d617284 100644
--- a/src/DbUp.MySql/DbUp.MySql.csproj
+++ b/src/DbUp.MySql/DbUp.MySql.csproj
@@ -32,6 +32,12 @@
4
bin\Release\DbUp.MySql.XML
+
+ true
+
+
+ dbup.snk
+
..\..\lib\MySql.Data.6.9.3\lib\net20\MySql.Data.dll
@@ -57,6 +63,7 @@
+
diff --git a/src/DbUp.MySql/DbUp.MySql.v2.ncrunchproject b/src/DbUp.MySql/DbUp.MySql.v2.ncrunchproject
new file mode 100644
index 00000000..cdfbdeb6
Binary files /dev/null and b/src/DbUp.MySql/DbUp.MySql.v2.ncrunchproject differ
diff --git a/src/DbUp.MySql/dbup.snk b/src/DbUp.MySql/dbup.snk
new file mode 100644
index 00000000..1a7adc60
Binary files /dev/null and b/src/DbUp.MySql/dbup.snk differ
diff --git a/src/DbUp.Postgresql/DbUp.Postgresql.v2.ncrunchproject b/src/DbUp.Postgresql/DbUp.Postgresql.v2.ncrunchproject
new file mode 100644
index 00000000..cdfbdeb6
Binary files /dev/null and b/src/DbUp.Postgresql/DbUp.Postgresql.v2.ncrunchproject differ
diff --git a/src/DbUp.SQLite/DbUp.SQLite.v2.ncrunchproject b/src/DbUp.SQLite/DbUp.SQLite.v2.ncrunchproject
new file mode 100644
index 00000000..896f2193
--- /dev/null
+++ b/src/DbUp.SQLite/DbUp.SQLite.v2.ncrunchproject
@@ -0,0 +1,22 @@
+
+ false
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ true
+ 60000
+
+
+
+ AutoDetect
+ STA
+ x86
+
\ No newline at end of file
diff --git a/src/DbUp.SqlCe/DbUp.SqlCe.v2.ncrunchproject b/src/DbUp.SqlCe/DbUp.SqlCe.v2.ncrunchproject
new file mode 100644
index 00000000..8641d361
--- /dev/null
+++ b/src/DbUp.SqlCe/DbUp.SqlCe.v2.ncrunchproject
@@ -0,0 +1,19 @@
+
+ false
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ true
+ 60000
+
+
+ AutoDetect
+
\ No newline at end of file
diff --git a/src/DbUp.Tests/ApiTests.cs b/src/DbUp.Tests/ApiTests.cs
new file mode 100644
index 00000000..ec46cb6d
--- /dev/null
+++ b/src/DbUp.Tests/ApiTests.cs
@@ -0,0 +1,48 @@
+using ApiApprover;
+using ApprovalTests.Reporters;
+using DbUp.Builder;
+using NUnit.Framework;
+
+namespace DbUp.Tests
+{
+ [TestFixture]
+ [UseReporter(typeof(DiffReporter))]
+ public class ApiTests
+ {
+ [Test]
+ public void dbup_has_no_public_api_changes()
+ {
+ PublicApiApprover.ApprovePublicApi(typeof(SupportedDatabases).Assembly.Location);
+ }
+
+ [Test]
+ public void dbup_firebird_has_no_public_api_changes()
+ {
+ PublicApiApprover.ApprovePublicApi(typeof(FirebirdExtensions).Assembly.Location);
+ }
+
+ [Test]
+ public void dbup_mysql_has_no_public_api_changes()
+ {
+ PublicApiApprover.ApprovePublicApi(typeof(MySqlExtensions).Assembly.Location);
+ }
+
+ [Test]
+ public void dbup_postgres_has_no_public_api_changes()
+ {
+ PublicApiApprover.ApprovePublicApi(typeof(PostgresqlExtensions).Assembly.Location);
+ }
+
+ [Test]
+ public void dbup_sqlce_has_no_public_api_changes()
+ {
+ PublicApiApprover.ApprovePublicApi(typeof(SqlCeExtensions).Assembly.Location);
+ }
+
+ [Test]
+ public void dbup_sqlite_has_no_public_api_changes()
+ {
+ PublicApiApprover.ApprovePublicApi(typeof(SQLiteExtensions).Assembly.Location);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/DbUp.Tests/App_Packages/ApiApprover.3.0.1/PublicApiApprover.cs b/src/DbUp.Tests/App_Packages/ApiApprover.3.0.1/PublicApiApprover.cs
new file mode 100644
index 00000000..cc17e6ca
--- /dev/null
+++ b/src/DbUp.Tests/App_Packages/ApiApprover.3.0.1/PublicApiApprover.cs
@@ -0,0 +1,43 @@
+using System.IO;
+using ApprovalTests;
+using ApprovalTests.Namers;
+using Mono.Cecil;
+
+namespace ApiApprover
+{
+ public static class PublicApiApprover
+ {
+ public static void ApprovePublicApi(string assemblyPath)
+ {
+ var assemblyResolver = new DefaultAssemblyResolver();
+ assemblyResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath));
+
+ var readSymbols = File.Exists(Path.ChangeExtension(assemblyPath, ".pdb"));
+ var asm = AssemblyDefinition.ReadAssembly(assemblyPath, new ReaderParameters(ReadingMode.Deferred)
+ {
+ ReadSymbols = readSymbols,
+ AssemblyResolver = assemblyResolver,
+ });
+
+ var publicApi = PublicApiGenerator.CreatePublicApiForAssembly(asm);
+ var writer = new ApprovalTextWriter(publicApi, "cs");
+ var approvalNamer = new AssemblyPathNamer(assemblyPath);
+ ApprovalTests.Approvals.Verify(writer, approvalNamer, ApprovalTests.Approvals.GetReporter());
+ }
+
+ private class AssemblyPathNamer : UnitTestFrameworkNamer
+ {
+ private readonly string name;
+
+ public AssemblyPathNamer(string assemblyPath)
+ {
+ name = Path.GetFileNameWithoutExtension(assemblyPath);
+ }
+
+ public override string Name
+ {
+ get { return name; }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/DbUp.Tests/App_Packages/ApiApprover.3.0.1/PublicApiGenerator.cs b/src/DbUp.Tests/App_Packages/ApiApprover.3.0.1/PublicApiGenerator.cs
new file mode 100644
index 00000000..424d5db4
--- /dev/null
+++ b/src/DbUp.Tests/App_Packages/ApiApprover.3.0.1/PublicApiGenerator.cs
@@ -0,0 +1,794 @@
+using System;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Microsoft.CSharp;
+using Mono.Cecil;
+using Mono.Cecil.Rocks;
+using TypeAttributes = System.Reflection.TypeAttributes;
+
+// ReSharper disable CheckNamespace
+// ReSharper disable BitwiseOperatorOnEnumWithoutFlags
+namespace ApiApprover
+{
+ public static class CecilEx
+ {
+ public static IEnumerable GetMembers(this TypeDefinition type)
+ {
+ return type.Fields.Cast()
+ .Concat(type.Methods)
+ .Concat(type.Properties)
+ .Concat(type.Events);
+ }
+ }
+
+
+ public static class PublicApiGenerator
+ {
+ // TODO: Assembly references?
+ // TODO: Better handle namespaces - using statements? - requires non-qualified type names
+ public static string CreatePublicApiForAssembly(AssemblyDefinition assembly)
+ {
+ return CreatePublicApiForAssembly(assembly, t => true, true);
+ }
+
+ public static string CreatePublicApiForAssembly(AssemblyDefinition assembly, Func shouldIncludeType, bool shouldIncludeAssemblyAttributes)
+ {
+ var publicApiBuilder = new StringBuilder();
+ var cgo = new CodeGeneratorOptions
+ {
+ BracingStyle = "C",
+ BlankLinesBetweenMembers = false,
+ VerbatimOrder = false
+ };
+
+ using (var provider = new CSharpCodeProvider())
+ {
+ var compileUnit = new CodeCompileUnit();
+ if (shouldIncludeAssemblyAttributes && assembly.HasCustomAttributes)
+ {
+ PopulateCustomAttributes(assembly, compileUnit.AssemblyCustomAttributes);
+ }
+
+ var publicTypes = assembly.Modules.SelectMany(m => m.GetTypes())
+ .Where(t => !t.IsNested && ShouldIncludeType(t) && shouldIncludeType(t))
+ .OrderBy(t => t.FullName);
+ foreach (var publicType in publicTypes)
+ {
+ var @namespace = compileUnit.Namespaces.Cast()
+ .FirstOrDefault(n => n.Name == publicType.Namespace);
+ if (@namespace == null)
+ {
+ @namespace = new CodeNamespace(publicType.Namespace);
+ compileUnit.Namespaces.Add(@namespace);
+ }
+
+ var typeDeclaration = CreateTypeDeclaration(publicType);
+ @namespace.Types.Add(typeDeclaration);
+ }
+
+ using (var writer = new StringWriter())
+ {
+ provider.GenerateCodeFromCompileUnit(compileUnit, writer, cgo);
+ var typeDeclarationText = NormaliseGeneratedCode(writer);
+ publicApiBuilder.AppendLine(typeDeclarationText);
+ }
+ }
+ return NormaliseLineEndings(publicApiBuilder.ToString().Trim());
+ }
+
+ private static string NormaliseLineEndings(string value)
+ {
+ return Regex.Replace(value, @"\r\n|\n\r|\r|\n", Environment.NewLine);
+ }
+
+ private static bool IsDelegate(TypeDefinition publicType)
+ {
+ return publicType.BaseType != null && publicType.BaseType.FullName == "System.MulticastDelegate";
+ }
+
+ private static bool ShouldIncludeType(TypeDefinition t)
+ {
+ return (t.IsPublic || t.IsNestedPublic || t.IsNestedFamily) && !IsCompilerGenerated(t);
+ }
+
+ private static bool ShouldIncludeMember(IMemberDefinition m)
+ {
+ return !IsCompilerGenerated(m) && !IsDotNetTypeMember(m) && !(m is FieldDefinition);
+ }
+
+ private static bool IsCompilerGenerated(IMemberDefinition m)
+ {
+ return m.CustomAttributes.Any(a => a.AttributeType.FullName == "System.Runtime.CompilerServices.CompilerGeneratedAttribute");
+ }
+
+ private static bool IsDotNetTypeMember(IMemberDefinition m)
+ {
+ if (m.DeclaringType == null || m.DeclaringType.FullName == null)
+ return false;
+ return m.DeclaringType.FullName.StartsWith("System") || m.DeclaringType.FullName.StartsWith("Microsoft");
+ }
+
+ static void AddMemberToTypeDeclaration(CodeTypeDeclaration typeDeclaration, IMemberDefinition memberInfo)
+ {
+ var methodDefinition = memberInfo as MethodDefinition;
+ if (methodDefinition != null)
+ {
+ if (methodDefinition.IsConstructor)
+ AddCtorToTypeDeclaration(typeDeclaration, methodDefinition);
+ else
+ AddMethodToTypeDeclaration(typeDeclaration, methodDefinition);
+ }
+ else if (memberInfo is PropertyDefinition)
+ {
+ AddPropertyToTypeDeclaration(typeDeclaration, (PropertyDefinition) memberInfo);
+ }
+ else if (memberInfo is EventDefinition)
+ {
+ typeDeclaration.Members.Add(GenerateEvent((EventDefinition)memberInfo));
+ }
+ else if (memberInfo is FieldDefinition)
+ {
+ AddFieldToTypeDeclaration(typeDeclaration, (FieldDefinition) memberInfo);
+ }
+ }
+
+ static string NormaliseGeneratedCode(StringWriter writer)
+ {
+ var gennedClass = writer.ToString();
+ const string autoGeneratedHeader = @"^//-+\s*$.*^//-+\s*$";
+ const string emptyGetSet = @"\s+{\s+get\s+{\s+}\s+set\s+{\s+}\s+}";
+ const string emptyGet = @"\s+{\s+get\s+{\s+}\s+}";
+ const string emptySet = @"\s+{\s+set\s+{\s+}\s+}";
+ const string getSet = @"\s+{\s+get;\s+set;\s+}";
+ const string get = @"\s+{\s+get;\s+}";
+ const string set = @"\s+{\s+set;\s+}";
+ gennedClass = Regex.Replace(gennedClass, autoGeneratedHeader, string.Empty,
+ RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline | RegexOptions.Singleline);
+ gennedClass = Regex.Replace(gennedClass, emptyGetSet, " { get; set; }", RegexOptions.IgnorePatternWhitespace);
+ gennedClass = Regex.Replace(gennedClass, getSet, " { get; set; }", RegexOptions.IgnorePatternWhitespace);
+ gennedClass = Regex.Replace(gennedClass, emptyGet, " { get; }", RegexOptions.IgnorePatternWhitespace);
+ gennedClass = Regex.Replace(gennedClass, emptySet, " { set; }", RegexOptions.IgnorePatternWhitespace);
+ gennedClass = Regex.Replace(gennedClass, get, " { get; }", RegexOptions.IgnorePatternWhitespace);
+ gennedClass = Regex.Replace(gennedClass, set, " { set; }", RegexOptions.IgnorePatternWhitespace);
+ gennedClass = Regex.Replace(gennedClass, @"\s+{\s+}", " { }", RegexOptions.IgnorePatternWhitespace);
+ gennedClass = Regex.Replace(gennedClass, @"\)\s+;", ");", RegexOptions.IgnorePatternWhitespace);
+ return gennedClass;
+ }
+
+ static CodeTypeDeclaration CreateTypeDeclaration(TypeDefinition publicType)
+ {
+ if (IsDelegate(publicType))
+ return CreateDelegateDeclaration(publicType);
+
+ bool @static = false;
+ TypeAttributes attributes = 0;
+ if (publicType.IsPublic || publicType.IsNestedPublic)
+ attributes |= TypeAttributes.Public;
+ if (publicType.IsNestedFamily)
+ attributes |= TypeAttributes.NestedFamily;
+ if (publicType.IsSealed && !publicType.IsAbstract)
+ attributes |= TypeAttributes.Sealed;
+ else if (!publicType.IsSealed && publicType.IsAbstract && !publicType.IsInterface)
+ attributes |= TypeAttributes.Abstract;
+ else if (publicType.IsSealed && publicType.IsAbstract)
+ @static = true;
+
+ // Static support is a hack. CodeDOM does support it, and this isn't
+ // correct C#, but it's good enough for our API outline
+ var name = publicType.Name;
+
+ var index = name.IndexOf('`');
+ if (index != -1)
+ name = name.Substring(0, index);
+ var declaration = new CodeTypeDeclaration(@static ? "static " + name : name)
+ {
+ CustomAttributes = CreateCustomAttributes(publicType),
+ // TypeAttributes must be specified before the IsXXX as they manipulate TypeAttributes!
+ TypeAttributes = attributes,
+ IsClass = publicType.IsClass,
+ IsEnum = publicType.IsEnum,
+ IsInterface = publicType.IsInterface,
+ IsStruct = publicType.IsValueType && !publicType.IsPrimitive && !publicType.IsEnum,
+ };
+
+ if (declaration.IsInterface && publicType.BaseType != null)
+ throw new NotImplementedException("Base types for interfaces needs testing");
+
+ PopulateGenericParameters(publicType, declaration.TypeParameters);
+
+ if (publicType.BaseType != null && ShouldOutputBaseType(publicType))
+ {
+ if (publicType.BaseType.FullName == "System.Enum")
+ {
+ var underlyingType = publicType.GetEnumUnderlyingType();
+ if (underlyingType.FullName != "System.Int32")
+ declaration.BaseTypes.Add(CreateCodeTypeReference(underlyingType));
+ }
+ else
+ declaration.BaseTypes.Add(CreateCodeTypeReference(publicType.BaseType));
+ }
+ foreach (var @interface in publicType.Interfaces.OrderBy(i => i.FullName))
+ declaration.BaseTypes.Add(CreateCodeTypeReference(@interface));
+
+ foreach (var memberInfo in publicType.GetMembers().Where(ShouldIncludeMember).OrderBy(m => m.Name))
+ AddMemberToTypeDeclaration(declaration, memberInfo);
+
+ // Fields should be in defined order for an enum
+ var fields = !publicType.IsEnum
+ ? publicType.Fields.OrderBy(f => f.Name)
+ : (IEnumerable)publicType.Fields;
+ foreach (var field in fields)
+ AddMemberToTypeDeclaration(declaration, field);
+
+ foreach (var nestedType in publicType.NestedTypes.Where(ShouldIncludeType).OrderBy(t => t.FullName))
+ {
+ var nestedTypeDeclaration = CreateTypeDeclaration(nestedType);
+ declaration.Members.Add(nestedTypeDeclaration);
+ }
+
+ return declaration;
+ }
+
+ private static CodeTypeDeclaration CreateDelegateDeclaration(TypeDefinition publicType)
+ {
+ var invokeMethod = publicType.Methods.Single(m => m.Name == "Invoke");
+ var name = publicType.Name;
+ var index = name.IndexOf('`');
+ if (index != -1)
+ name = name.Substring(0, index);
+ var declaration = new CodeTypeDelegate(name)
+ {
+ Attributes = MemberAttributes.Public,
+ CustomAttributes = CreateCustomAttributes(publicType),
+ ReturnType = CreateCodeTypeReference(invokeMethod.ReturnType),
+ };
+
+ // CodeDOM. No support. Return type attributes.
+ PopulateCustomAttributes(invokeMethod.MethodReturnType, declaration.CustomAttributes, type => ModifyCodeTypeReference(type, "return:"));
+ PopulateGenericParameters(publicType, declaration.TypeParameters);
+ PopulateMethodParameters(invokeMethod, declaration.Parameters);
+
+ // Of course, CodeDOM doesn't support generic type parameters for delegates. Of course.
+ if (declaration.TypeParameters.Count > 0)
+ {
+ var parameterNames = from parameterType in declaration.TypeParameters.Cast()
+ select parameterType.Name;
+ declaration.Name = string.Format("{0}<{1}>", declaration.Name, string.Join(", ", parameterNames));
+ }
+
+ return declaration;
+ }
+
+ private static bool ShouldOutputBaseType(TypeDefinition publicType)
+ {
+ return publicType.BaseType.FullName != "System.Object" && publicType.BaseType.FullName != "System.ValueType";
+ }
+
+ private static void PopulateGenericParameters(IGenericParameterProvider publicType, CodeTypeParameterCollection parameters)
+ {
+ foreach (var parameter in publicType.GenericParameters)
+ {
+ if (parameter.HasCustomAttributes)
+ throw new NotImplementedException("Attributes on type parameters is not supported. And weird");
+
+ // A little hacky. Means we get "in" and "out" prefixed on any constraints, but it's either that
+ // or add it as a custom attribute, which looks even weirder
+ var name = parameter.Name;
+ if (parameter.IsCovariant)
+ name = "out " + name;
+ if (parameter.IsContravariant)
+ name = "in " + name;
+
+ var typeParameter = new CodeTypeParameter(name)
+ {
+ HasConstructorConstraint =
+ parameter.HasDefaultConstructorConstraint && !parameter.HasNotNullableValueTypeConstraint
+ };
+ if (parameter.HasNotNullableValueTypeConstraint)
+ typeParameter.Constraints.Add(" struct"); // Extra space is a hack!
+ if (parameter.HasReferenceTypeConstraint)
+ typeParameter.Constraints.Add(" class");
+ foreach (var constraint in parameter.Constraints.Where(t => t.FullName != "System.ValueType"))
+ {
+ typeParameter.Constraints.Add(CreateCodeTypeReference(constraint.GetElementType()));
+ }
+ parameters.Add(typeParameter);
+ }
+ }
+
+ private static CodeAttributeDeclarationCollection CreateCustomAttributes(ICustomAttributeProvider type)
+ {
+ var attributes = new CodeAttributeDeclarationCollection();
+ PopulateCustomAttributes(type, attributes);
+ return attributes;
+ }
+
+ private static void PopulateCustomAttributes(ICustomAttributeProvider type,
+ CodeAttributeDeclarationCollection attributes)
+ {
+ PopulateCustomAttributes(type, attributes, ctr => ctr);
+ }
+
+ private static void PopulateCustomAttributes(ICustomAttributeProvider type,
+ CodeAttributeDeclarationCollection attributes, Func codeTypeModifier)
+ {
+ foreach (var customAttribute in type.CustomAttributes.Where(ShouldIncludeAttribute).OrderBy(a => a.AttributeType.FullName).ThenBy(a => ConvertAttrbuteToCode(codeTypeModifier, a)))
+ {
+ var attribute = GenerateCodeAttributeDeclaration(codeTypeModifier, customAttribute);
+ attributes.Add(attribute);
+ }
+ }
+
+ private static CodeAttributeDeclaration GenerateCodeAttributeDeclaration(Func codeTypeModifier, CustomAttribute customAttribute)
+ {
+ var attribute = new CodeAttributeDeclaration(codeTypeModifier(CreateCodeTypeReference(customAttribute.AttributeType)));
+ foreach (var arg in customAttribute.ConstructorArguments)
+ {
+ attribute.Arguments.Add(new CodeAttributeArgument(CreateInitialiserExpression(arg)));
+ }
+ foreach (var field in customAttribute.Fields.OrderBy(f => f.Name))
+ {
+ attribute.Arguments.Add(new CodeAttributeArgument(field.Name, CreateInitialiserExpression(field.Argument)));
+ }
+ foreach (var property in customAttribute.Properties.OrderBy(p => p.Name))
+ {
+ attribute.Arguments.Add(new CodeAttributeArgument(property.Name, CreateInitialiserExpression(property.Argument)));
+ }
+ return attribute;
+ }
+
+ // Litee: This method is used for additional sorting of custom attributes when multiple values are allowed
+ private static object ConvertAttrbuteToCode(Func codeTypeModifier, CustomAttribute customAttribute)
+ {
+ using (var provider = new CSharpCodeProvider())
+ {
+ var cgo = new CodeGeneratorOptions
+ {
+ BracingStyle = "C",
+ BlankLinesBetweenMembers = false,
+ VerbatimOrder = false
+ };
+ var attribute = GenerateCodeAttributeDeclaration(codeTypeModifier, customAttribute);
+ var declaration = new CodeTypeDeclaration("DummyClass")
+ {
+ CustomAttributes = new CodeAttributeDeclarationCollection(new[] { attribute }),
+ };
+ using (var writer = new StringWriter())
+ {
+ provider.GenerateCodeFromType(declaration, writer, cgo);
+ return writer.ToString();
+ }
+ }
+ }
+
+ private static readonly HashSet SkipAttributeNames = new HashSet
+ {
+ "System.CodeDom.Compiler.GeneratedCodeAttribute",
+ "System.ComponentModel.EditorBrowsableAttribute",
+ "System.Runtime.CompilerServices.AsyncStateMachineAttribute",
+ "System.Runtime.CompilerServices.CompilerGeneratedAttribute",
+ "System.Runtime.CompilerServices.CompilationRelaxationsAttribute",
+ "System.Runtime.CompilerServices.ExtensionAttribute",
+ "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute",
+ "System.Reflection.DefaultMemberAttribute",
+ "System.Diagnostics.DebuggableAttribute",
+ "System.Diagnostics.DebuggerNonUserCodeAttribute",
+ "System.Diagnostics.DebuggerStepThroughAttribute",
+ "System.Reflection.AssemblyCompanyAttribute",
+ "System.Reflection.AssemblyConfigurationAttribute",
+ "System.Reflection.AssemblyCopyrightAttribute",
+ "System.Reflection.AssemblyDescriptionAttribute",
+ "System.Reflection.AssemblyFileVersionAttribute",
+ "System.Reflection.AssemblyInformationalVersionAttribute",
+ "System.Reflection.AssemblyProductAttribute",
+ "System.Reflection.AssemblyTitleAttribute",
+ "System.Reflection.AssemblyTrademarkAttribute"
+ };
+
+ private static bool ShouldIncludeAttribute(CustomAttribute attribute)
+ {
+ return !SkipAttributeNames.Contains(attribute.AttributeType.FullName);
+ }
+
+ private static CodeExpression CreateInitialiserExpression(CustomAttributeArgument attributeArgument)
+ {
+ if (attributeArgument.Value is CustomAttributeArgument)
+ {
+ return CreateInitialiserExpression((CustomAttributeArgument) attributeArgument.Value);
+ }
+
+ if (attributeArgument.Value is CustomAttributeArgument[])
+ {
+ var initialisers = from argument in (CustomAttributeArgument[]) attributeArgument.Value
+ select CreateInitialiserExpression(argument);
+ return new CodeArrayCreateExpression(CreateCodeTypeReference(attributeArgument.Type), initialisers.ToArray());
+ }
+
+ var type = attributeArgument.Type.Resolve();
+ var value = attributeArgument.Value;
+ if (type.BaseType != null && type.BaseType.FullName == "System.Enum")
+ {
+ var originalValue = Convert.ToInt64(value);
+ if (type.CustomAttributes.Any(a => a.AttributeType.FullName == "System.FlagsAttribute"))
+ {
+ //var allFlags = from f in type.Fields
+ // where f.Constant != null
+ // let v = Convert.ToInt64(f.Constant)
+ // where v == 0 || (originalValue & v) != 0
+ // select (CodeExpression)new CodeFieldReferenceExpression(typeExpression, f.Name);
+ //return allFlags.Aggregate((current, next) => new CodeBinaryOperatorExpression(current, CodeBinaryOperatorType.BitwiseOr, next));
+
+ // I'd rather use the above, as it's just using the CodeDOM, but it puts
+ // brackets around each CodeBinaryOperatorExpression
+ var flags = from f in type.Fields
+ where f.Constant != null
+ let v = Convert.ToInt64(f.Constant)
+ where v == 0 || (originalValue & v) != 0
+ select type.FullName + "." + f.Name;
+ return new CodeSnippetExpression(flags.Aggregate((current, next) => current + " | " + next));
+ }
+
+ var allFlags = from f in type.Fields
+ where f.Constant != null
+ let v = Convert.ToInt64(f.Constant)
+ where v == originalValue
+ select new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(CreateCodeTypeReference(type)), f.Name);
+ return allFlags.FirstOrDefault();
+ }
+
+ if (type.FullName == "System.Type" && value is TypeReference)
+ {
+ return new CodeTypeOfExpression(CreateCodeTypeReference((TypeReference)value));
+ }
+
+ if (value is string)
+ {
+ // CodeDOM outputs a verbatim string. Any string with \n is treated as such, so normalise
+ // it to make it easier for comparisons
+ value = Regex.Replace((string)value, @"\n", "\\n");
+ value = Regex.Replace((string)value, @"\r\n|\r\\n", "\\r\\n");
+ }
+
+ return new CodePrimitiveExpression(value);
+ }
+
+ private static void AddCtorToTypeDeclaration(CodeTypeDeclaration typeDeclaration, MethodDefinition member)
+ {
+ if (member.IsAssembly || member.IsPrivate)
+ return;
+
+ var method = new CodeConstructor
+ {
+ CustomAttributes = CreateCustomAttributes(member),
+ Name = member.Name,
+ Attributes = GetMethodAttributes(member)
+ };
+ PopulateMethodParameters(member, method.Parameters);
+
+ typeDeclaration.Members.Add(method);
+ }
+
+ private static void AddMethodToTypeDeclaration(CodeTypeDeclaration typeDeclaration, MethodDefinition member)
+ {
+ if (member.IsAssembly || member.IsPrivate || member.IsSpecialName)
+ return;
+
+ var returnType = CreateCodeTypeReference(member.ReturnType);
+ if (IsAsyncMethod(member))
+ returnType = MakeAsync(returnType);
+
+ var method = new CodeMemberMethod
+ {
+ Name = member.Name,
+ Attributes = GetMethodAttributes(member),
+ CustomAttributes = CreateCustomAttributes(member),
+ ReturnType = returnType,
+ };
+ PopulateCustomAttributes(member.MethodReturnType, method.ReturnTypeCustomAttributes);
+ PopulateGenericParameters(member, method.TypeParameters);
+ PopulateMethodParameters(member, method.Parameters, IsExtensionMethod(member));
+
+ typeDeclaration.Members.Add(method);
+ }
+
+ private static bool IsAsyncMethod(ICustomAttributeProvider method)
+ {
+ return method.CustomAttributes.Any(a => a.AttributeType.FullName == "System.Runtime.CompilerServices.AsyncStateMachineAttribute");
+ }
+
+ private static bool IsExtensionMethod(ICustomAttributeProvider method)
+ {
+ return method.CustomAttributes.Any(a => a.AttributeType.FullName == "System.Runtime.CompilerServices.ExtensionAttribute");
+ }
+
+ private static void PopulateMethodParameters(IMethodSignature member,
+ CodeParameterDeclarationExpressionCollection parameters, bool isExtension = false)
+ {
+ foreach (var parameter in member.Parameters)
+ {
+ FieldDirection direction = 0;
+ if (parameter.IsOut)
+ direction |= FieldDirection.Out;
+ else if (parameter.ParameterType.IsByReference)
+ direction |= FieldDirection.Ref;
+
+ var parameterType = parameter.ParameterType.IsByReference
+ ? parameter.ParameterType.GetElementType()
+ : parameter.ParameterType;
+
+ var type = CreateCodeTypeReference(parameterType);
+
+ if (isExtension)
+ {
+ type = ModifyCodeTypeReference(type, "this");
+ isExtension = false;
+ }
+
+ var name = parameter.HasConstant
+ ? string.Format("{0} = {1}", parameter.Name, FormatParameterConstant(parameter))
+ : parameter.Name;
+ var expression = new CodeParameterDeclarationExpression(type, name)
+ {
+ Direction = direction,
+ CustomAttributes = CreateCustomAttributes(parameter)
+ };
+ parameters.Add(expression);
+ }
+ }
+
+ private static object FormatParameterConstant(IConstantProvider parameter)
+ {
+ return parameter.Constant is string ? string.Format("\"{0}\"", parameter.Constant) : (parameter.Constant ?? "null");
+ }
+
+ static MemberAttributes GetMethodAttributes(MethodDefinition method)
+ {
+ MemberAttributes access = 0;
+ if (method.IsFamily)
+ access = MemberAttributes.Family;
+ if (method.IsPublic)
+ access = MemberAttributes.Public;
+ if (method.IsAssembly)
+ access = MemberAttributes.Assembly;
+ if (method.IsFamilyAndAssembly)
+ access = MemberAttributes.FamilyAndAssembly;
+ if (method.IsFamilyOrAssembly)
+ access = MemberAttributes.FamilyOrAssembly;
+
+ MemberAttributes scope = 0;
+ if (method.IsStatic)
+ scope |= MemberAttributes.Static;
+ if (method.IsFinal || !method.IsVirtual)
+ scope |= MemberAttributes.Final;
+ if (method.IsAbstract)
+ scope |= MemberAttributes.Abstract;
+ if (method.IsVirtual && !method.IsNewSlot)
+ scope |= MemberAttributes.Override;
+
+ MemberAttributes vtable = 0;
+ if (IsHidingMethod(method))
+ vtable = MemberAttributes.New;
+
+ return access | scope | vtable;
+ }
+
+ private static bool IsHidingMethod(MethodDefinition method)
+ {
+ var typeDefinition = method.DeclaringType;
+
+ // If we're an interface, just try and find any method with the same signature
+ // in any of the interfaces that we implement
+ if (typeDefinition.IsInterface)
+ {
+ var interfaceMethods = from @interfaceReference in typeDefinition.Interfaces
+ let interfaceDefinition = @interfaceReference.Resolve()
+ where interfaceDefinition != null
+ select interfaceDefinition.Methods;
+
+ return interfaceMethods.Any(ms => MetadataResolver.GetMethod(ms, method) != null);
+ }
+
+ // If we're not an interface, find a base method that isn't virtual
+ return !method.IsVirtual && GetBaseTypes(typeDefinition).Any(d => MetadataResolver.GetMethod(d.Methods, method) != null);
+ }
+
+ private static IEnumerable GetBaseTypes(TypeDefinition type)
+ {
+ var baseType = type.BaseType;
+ while (baseType != null)
+ {
+ var definition = baseType.Resolve();
+ if (definition == null)
+ yield break;
+ yield return definition;
+
+ baseType = baseType.DeclaringType;
+ }
+ }
+
+ private static void AddPropertyToTypeDeclaration(CodeTypeDeclaration typeDeclaration, PropertyDefinition member)
+ {
+ var getterAttributes = member.GetMethod != null ? GetMethodAttributes(member.GetMethod) : 0;
+ var setterAttributes = member.SetMethod != null ? GetMethodAttributes(member.SetMethod) : 0;
+
+ if (!HasVisiblePropertyMethod(getterAttributes) && !HasVisiblePropertyMethod(setterAttributes))
+ return;
+
+ var propertyAttributes = GetPropertyAttributes(getterAttributes, setterAttributes);
+
+ var propertyType = member.PropertyType.IsGenericParameter
+ ? new CodeTypeReference(member.PropertyType.Name)
+ : CreateCodeTypeReference(member.PropertyType);
+
+ var property = new CodeMemberProperty
+ {
+ Name = member.Name,
+ Type = propertyType,
+ Attributes = propertyAttributes,
+ CustomAttributes = CreateCustomAttributes(member),
+ HasGet = member.GetMethod != null && HasVisiblePropertyMethod(getterAttributes),
+ HasSet = member.SetMethod != null && HasVisiblePropertyMethod(setterAttributes)
+ };
+
+ // Here's a nice hack, because hey, guess what, the CodeDOM doesn't support
+ // attributes on getters or setters
+ if (member.GetMethod != null && member.GetMethod.HasCustomAttributes)
+ {
+ PopulateCustomAttributes(member.GetMethod, property.CustomAttributes, type => ModifyCodeTypeReference(type, "get:"));
+ }
+ if (member.SetMethod != null && member.SetMethod.HasCustomAttributes)
+ {
+ PopulateCustomAttributes(member.GetMethod, property.CustomAttributes, type => ModifyCodeTypeReference(type, "set:"));
+ }
+
+ foreach (var parameter in member.Parameters)
+ {
+ property.Parameters.Add(
+ new CodeParameterDeclarationExpression(CreateCodeTypeReference(parameter.ParameterType),
+ parameter.Name));
+ }
+
+ // TODO: CodeDOM has no support for different access modifiers for getters and setters
+ // TODO: CodeDOM has no support for attributes on setters or getters - promote to property?
+
+ typeDeclaration.Members.Add(property);
+ }
+
+ private static MemberAttributes GetPropertyAttributes(MemberAttributes getterAttributes, MemberAttributes setterAttributes)
+ {
+ MemberAttributes access = 0;
+ var getterAccess = getterAttributes & MemberAttributes.AccessMask;
+ var setterAccess = setterAttributes & MemberAttributes.AccessMask;
+ if (getterAccess == MemberAttributes.Public || setterAccess == MemberAttributes.Public)
+ access = MemberAttributes.Public;
+ else if (getterAccess == MemberAttributes.Family || setterAccess == MemberAttributes.Family)
+ access = MemberAttributes.Family;
+ else if (getterAccess == MemberAttributes.FamilyAndAssembly || setterAccess == MemberAttributes.FamilyAndAssembly)
+ access = MemberAttributes.FamilyAndAssembly;
+ else if (getterAccess == MemberAttributes.FamilyOrAssembly || setterAccess == MemberAttributes.FamilyOrAssembly)
+ access = MemberAttributes.FamilyOrAssembly;
+ else if (getterAccess == MemberAttributes.Assembly || setterAccess == MemberAttributes.Assembly)
+ access = MemberAttributes.Assembly;
+ else if (getterAccess == MemberAttributes.Private || setterAccess == MemberAttributes.Private)
+ access = MemberAttributes.Private;
+
+ // Scope should be the same for getter and setter. If one isn't specified, it'll be 0
+ var getterScope = getterAttributes & MemberAttributes.ScopeMask;
+ var setterScope = setterAttributes & MemberAttributes.ScopeMask;
+ var scope = (MemberAttributes) Math.Max((int) getterScope, (int) setterScope);
+
+ // Vtable should be the same for getter and setter. If one isn't specified, it'll be 0
+ var getterVtable = getterAttributes & MemberAttributes.VTableMask;
+ var setterVtable = setterAttributes & MemberAttributes.VTableMask;
+ var vtable = (MemberAttributes) Math.Max((int) getterVtable, (int) setterVtable);
+
+ return access | scope | vtable;
+ }
+
+ private static bool HasVisiblePropertyMethod(MemberAttributes attributes)
+ {
+ var access = attributes & MemberAttributes.AccessMask;
+ return access == MemberAttributes.Public || access == MemberAttributes.Family ||
+ access == MemberAttributes.FamilyOrAssembly;
+ }
+
+ static CodeTypeMember GenerateEvent(EventDefinition eventDefinition)
+ {
+ var @event = new CodeMemberEvent
+ {
+ Name = eventDefinition.Name,
+ Attributes = MemberAttributes.Public | MemberAttributes.Final,
+ CustomAttributes = CreateCustomAttributes(eventDefinition),
+ Type = CreateCodeTypeReference(eventDefinition.EventType)
+ };
+
+ return @event;
+ }
+
+ static void AddFieldToTypeDeclaration(CodeTypeDeclaration typeDeclaration, FieldDefinition memberInfo)
+ {
+ if (memberInfo.IsPrivate || memberInfo.IsAssembly || memberInfo.IsSpecialName)
+ return;
+
+ MemberAttributes attributes = 0;
+ if (memberInfo.HasConstant)
+ attributes |= MemberAttributes.Const;
+ if (memberInfo.IsFamily)
+ attributes |= MemberAttributes.Family;
+ if (memberInfo.IsPublic)
+ attributes |= MemberAttributes.Public;
+ if (memberInfo.IsStatic && !memberInfo.HasConstant)
+ attributes |= MemberAttributes.Static;
+
+ // TODO: Values for readonly fields are set in the ctor
+ var codeTypeReference = CreateCodeTypeReference(memberInfo.FieldType);
+ if (memberInfo.IsInitOnly)
+ codeTypeReference = MakeReadonly(codeTypeReference);
+ var field = new CodeMemberField(codeTypeReference, memberInfo.Name)
+ {
+ Attributes = attributes,
+ CustomAttributes = CreateCustomAttributes(memberInfo)
+ };
+
+ if (memberInfo.HasConstant)
+ field.InitExpression = new CodePrimitiveExpression(memberInfo.Constant);
+
+ typeDeclaration.Members.Add(field);
+ }
+
+ private static CodeTypeReference MakeReadonly(CodeTypeReference typeReference)
+ {
+ return ModifyCodeTypeReference(typeReference, "readonly");
+ }
+
+ private static CodeTypeReference MakeAsync(CodeTypeReference typeReference)
+ {
+ return ModifyCodeTypeReference(typeReference, "async");
+ }
+
+ private static CodeTypeReference ModifyCodeTypeReference(CodeTypeReference typeReference, string modifier)
+ {
+ using (var provider = new CSharpCodeProvider())
+ return new CodeTypeReference(modifier + " " + provider.GetTypeOutput(typeReference));
+ }
+
+ private static CodeTypeReference CreateCodeTypeReference(TypeReference type)
+ {
+ var typeName = GetTypeName(type);
+ return new CodeTypeReference(typeName, CreateGenericArguments(type));
+ }
+
+ private static string GetTypeName(TypeReference type)
+ {
+ if (type.IsGenericParameter)
+ return type.Name;
+
+ if (!type.IsNested)
+ {
+ return (!string.IsNullOrEmpty(type.Namespace) ? (type.Namespace + ".") : "") + type.Name;
+ }
+
+ return GetTypeName(type.DeclaringType) + "." + type.Name;
+ }
+
+ private static CodeTypeReference[] CreateGenericArguments(TypeReference type)
+ {
+ var genericInstance = type as IGenericInstance;
+ if (genericInstance == null) return null;
+
+ var genericArguments = new List();
+ foreach (var argument in genericInstance.GenericArguments)
+ {
+ genericArguments.Add(CreateCodeTypeReference(argument));
+ }
+ return genericArguments.ToArray();
+ }
+ }
+}
+// ReSharper restore BitwiseOperatorOnEnumWihtoutFlags
+// ReSharper restore CheckNamespace
diff --git a/src/DbUp.Tests/DbUp.Firebird.approved.cs b/src/DbUp.Tests/DbUp.Firebird.approved.cs
new file mode 100644
index 00000000..92e40108
--- /dev/null
+++ b/src/DbUp.Tests/DbUp.Firebird.approved.cs
@@ -0,0 +1,25 @@
+[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
+[assembly: System.Runtime.InteropServices.GuidAttribute("a0df89fb-5f3e-4690-af40-acf2816e89f1")]
+[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")]
+
+namespace DbUp.Firebird
+{
+
+ public class FirebirdConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager
+ {
+ public FirebirdConnectionManager(string connectionString) { }
+ protected override System.Data.IDbConnection CreateConnection(DbUp.Engine.Output.IUpgradeLog log) { }
+ public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { }
+ }
+ public class FirebirdPreprocessor : DbUp.Engine.IScriptPreprocessor
+ {
+ public FirebirdPreprocessor() { }
+ public string Process(string contents) { }
+ }
+}
+
+public class static FirebirdExtensions
+{
+ public static DbUp.Builder.UpgradeEngineBuilder FirebirdDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
+ public static DbUp.Builder.UpgradeEngineBuilder FirebirdDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
+}
\ No newline at end of file
diff --git a/src/DbUp.Tests/DbUp.MySql.approved.cs b/src/DbUp.Tests/DbUp.MySql.approved.cs
new file mode 100644
index 00000000..4cc9694d
--- /dev/null
+++ b/src/DbUp.Tests/DbUp.MySql.approved.cs
@@ -0,0 +1,24 @@
+[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
+[assembly: System.Runtime.InteropServices.GuidAttribute("b6988607-c547-4cbd-8012-f8162a25092f")]
+
+namespace DbUp.MySql
+{
+
+ public class MySqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager
+ {
+ public MySqlConnectionManager(string connectionString) { }
+ protected override System.Data.IDbConnection CreateConnection(DbUp.Engine.Output.IUpgradeLog log) { }
+ public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { }
+ }
+ public class MySqlPreprocessor : DbUp.Engine.IScriptPreprocessor
+ {
+ public MySqlPreprocessor() { }
+ public string Process(string contents) { }
+ }
+}
+
+public class static MySqlExtensions
+{
+ public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
+ public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
+}
\ No newline at end of file
diff --git a/src/DbUp.Tests/DbUp.Postgresql.approved.cs b/src/DbUp.Tests/DbUp.Postgresql.approved.cs
new file mode 100644
index 00000000..761793bf
--- /dev/null
+++ b/src/DbUp.Tests/DbUp.Postgresql.approved.cs
@@ -0,0 +1,25 @@
+[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
+[assembly: System.Runtime.InteropServices.GuidAttribute("5ddc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")]
+[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")]
+
+namespace DbUp.Postgresql
+{
+
+ public class PostgresqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager
+ {
+ public PostgresqlConnectionManager(string connectionString) { }
+ protected override System.Data.IDbConnection CreateConnection(DbUp.Engine.Output.IUpgradeLog log) { }
+ public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { }
+ }
+ public class PostgresqlPreprocessor : DbUp.Engine.IScriptPreprocessor
+ {
+ public PostgresqlPreprocessor() { }
+ public string Process(string contents) { }
+ }
+}
+
+public class static PostgresqlExtensions
+{
+ public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
+ public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
+}
\ No newline at end of file
diff --git a/src/DbUp.Tests/DbUp.SQLite.approved.cs b/src/DbUp.Tests/DbUp.SQLite.approved.cs
new file mode 100644
index 00000000..e67d6458
--- /dev/null
+++ b/src/DbUp.Tests/DbUp.SQLite.approved.cs
@@ -0,0 +1,62 @@
+[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
+[assembly: System.Runtime.InteropServices.GuidAttribute("9f949414-f078-49bf-b50e-a3859c18fb6e")]
+[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")]
+
+namespace DbUp.SQLite.Helpers
+{
+
+ public class InMemorySQLiteDatabase : System.IDisposable
+ {
+ public InMemorySQLiteDatabase() { }
+ public string ConnectionString { get; set; }
+ public DbUp.Helpers.AdHocSqlRunner SqlRunner { get; }
+ public void Dispose() { }
+ public DbUp.Engine.Transactions.IConnectionManager GetConnectionManager() { }
+ }
+ public class SharedConnection : System.Data.IDbConnection, System.IDisposable
+ {
+ public SharedConnection(System.Data.IDbConnection dbConnection) { }
+ public string ConnectionString { get; set; }
+ public int ConnectionTimeout { get; }
+ public string Database { get; }
+ public System.Data.ConnectionState State { get; }
+ public System.Data.IDbTransaction BeginTransaction(System.Data.IsolationLevel il) { }
+ public System.Data.IDbTransaction BeginTransaction() { }
+ public void ChangeDatabase(string databaseName) { }
+ public void Close() { }
+ public System.Data.IDbCommand CreateCommand() { }
+ public void Dispose() { }
+ public void DoClose() { }
+ public void Open() { }
+ }
+ public class TemporarySQLiteDatabase : System.IDisposable
+ {
+ public TemporarySQLiteDatabase(string name) { }
+ public DbUp.SQLite.Helpers.SharedConnection SharedConnection { get; }
+ public DbUp.Helpers.AdHocSqlRunner SqlRunner { get; }
+ public void Create() { }
+ public void Dispose() { }
+ }
+}
+namespace DbUp.SQLite
+{
+
+ public class SQLiteConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager
+ {
+ public SQLiteConnectionManager(string connectionString) { }
+ public SQLiteConnectionManager(DbUp.SQLite.Helpers.SharedConnection sharedConnection) { }
+ protected override System.Data.IDbConnection CreateConnection(DbUp.Engine.Output.IUpgradeLog log) { }
+ public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { }
+ }
+ public class SQLitePreprocessor : DbUp.Engine.IScriptPreprocessor
+ {
+ public SQLitePreprocessor() { }
+ public string Process(string contents) { }
+ }
+}
+
+public class static SQLiteExtensions
+{
+ public static DbUp.Builder.UpgradeEngineBuilder SQLiteDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
+ public static DbUp.Builder.UpgradeEngineBuilder SQLiteDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.SQLite.Helpers.SharedConnection sharedConnection) { }
+}
\ No newline at end of file
diff --git a/src/DbUp.Tests/DbUp.SqlCe.approved.cs b/src/DbUp.Tests/DbUp.SqlCe.approved.cs
new file mode 100644
index 00000000..87cdcee6
--- /dev/null
+++ b/src/DbUp.Tests/DbUp.SqlCe.approved.cs
@@ -0,0 +1,26 @@
+[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
+[assembly: System.Runtime.InteropServices.GuidAttribute("2523f9cc-42c7-48da-b873-74851c335931")]
+[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")]
+
+namespace DbUp.SqlCe
+{
+
+ public class SqlCeConnectionManager : DbUp.Support.SqlServer.SqlConnectionManager
+ {
+ public SqlCeConnectionManager(string connectionString) { }
+ protected override System.Data.IDbConnection CreateConnection(DbUp.Engine.Output.IUpgradeLog log) { }
+ }
+ public class SqlCePreprocessor : DbUp.Engine.IScriptPreprocessor
+ {
+ public SqlCePreprocessor() { }
+ public string Process(string contents) { }
+ }
+}
+
+public class static SqlCeExtensions
+{
+ [System.ObsoleteAttribute("Pass connection string instead, then use .WithTransaction() and .WithTransactionP" +
+ "erScript() to manage connection behaviour")]
+ public static DbUp.Builder.UpgradeEngineBuilder SqlCeDatabase(this DbUp.Builder.SupportedDatabases supported, System.Func connectionFactory) { }
+ public static DbUp.Builder.UpgradeEngineBuilder SqlCeDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
+}
\ No newline at end of file
diff --git a/src/DbUp.Tests/DbUp.Tests.csproj b/src/DbUp.Tests/DbUp.Tests.csproj
index 8716b861..fb05ecf9 100644
--- a/src/DbUp.Tests/DbUp.Tests.csproj
+++ b/src/DbUp.Tests/DbUp.Tests.csproj
@@ -39,6 +39,29 @@
..\..\lib\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\Mono.Data.Sqlite.dll
+
+ ..\packages\ApprovalTests.3.0.9\lib\net40\ApprovalTests.dll
+ True
+
+
+ ..\packages\ApprovalUtilities.3.0.9\lib\net35\ApprovalUtilities.dll
+ True
+
+
+ ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.dll
+ True
+
+
+ ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Mdb.dll
+ True
+
+
+ ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Pdb.dll
+ True
+
+
+ ..\packages\Mono.Cecil.0.9.6.1\lib\net40\Mono.Cecil.Rocks.dll
+ True
..\..\lib\NSubstitute.1.6.0.0\lib\NET40\NSubstitute.dll
@@ -72,6 +95,9 @@
+
+
+
@@ -97,6 +123,14 @@
+
+ {5D018E40-9BDE-4502-949B-D2E04936D083}
+ DbUp.Firebird
+
+
+ {4E0F1564-ED5F-49A6-8FB0-E8EB7EA2D63F}
+ DbUp.MySql
+
{27246d0e-bf23-4315-a946-ea8c93d9bff1}
DbUp.Postgresql
diff --git a/src/DbUp.Tests/DbUp.Tests.v2.ncrunchproject b/src/DbUp.Tests/DbUp.Tests.v2.ncrunchproject
new file mode 100644
index 00000000..ed589466
--- /dev/null
+++ b/src/DbUp.Tests/DbUp.Tests.v2.ncrunchproject
@@ -0,0 +1,23 @@
+
+ false
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ true
+ 60000
+
+
+
+ AutoDetect
+ STA
+ x86
+ PostBuildEventDisabled
+
\ No newline at end of file
diff --git a/src/DbUp.Tests/DbUp.approved.cs b/src/DbUp.Tests/DbUp.approved.cs
new file mode 100644
index 00000000..87c5eded
--- /dev/null
+++ b/src/DbUp.Tests/DbUp.approved.cs
@@ -0,0 +1,393 @@
+[assembly: System.CLSCompliantAttribute(true)]
+[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute(@"DbUp.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100876f68c54942e7974e58d217fcaf8bb582d6836830716c8b1d0d8ca86214838d0dee7e2bb294e9009c47b731227cebab0ad3a2ce5c0b3032bbd1ec5dd03f9779ccfd3c890946b97070c60f4103a4d969a869a23069761fcb19b8ef8dd93f4294a9bf0f165131dca23d9c494d53984f731e8a5ffb2c5543df4c3fd14a7ec74bee")]
+[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
+[assembly: System.Runtime.InteropServices.GuidAttribute("9f833e49-6e35-4e4d-b2a0-3d4fed527c89")]
+
+namespace DbUp.Builder
+{
+
+ public class SupportedDatabases
+ {
+ public SupportedDatabases() { }
+ }
+ public class UpgradeConfiguration
+ {
+ public UpgradeConfiguration() { }
+ public DbUp.Engine.Transactions.IConnectionManager ConnectionManager { get; set; }
+ public DbUp.Engine.IJournal Journal { get; set; }
+ public DbUp.Engine.Output.IUpgradeLog Log { get; set; }
+ public DbUp.Engine.IScriptExecutor ScriptExecutor { get; set; }
+ public System.Collections.Generic.List ScriptPreprocessors { get; }
+ public System.Collections.Generic.List ScriptProviders { get; }
+ public System.Collections.Generic.Dictionary Variables { get; }
+ public bool VariablesEnabled { get; set; }
+ public void AddVariables(System.Collections.Generic.IDictionary newVariables) { }
+ public void Validate() { }
+ }
+ public class UpgradeEngineBuilder
+ {
+ public UpgradeEngineBuilder() { }
+ public DbUp.Engine.UpgradeEngine Build() { }
+ public void Configure(System.Action configuration) { }
+ }
+}
+namespace DbUp
+{
+
+ public class static DeployChanges
+ {
+ public static DbUp.Builder.SupportedDatabases To { get; }
+ }
+ public class static Filters
+ {
+ public static System.Func ExcludeScriptNamesInFile(string fileName) { }
+ public static System.Func ExcludeScripts(params string[] scriptNames) { }
+ public static System.Func OnlyIncludeScriptNamesInFile(string fileName) { }
+ public static System.Func OnlyIncludeScripts(params string[] scriptNames) { }
+ }
+}
+namespace DbUp.Engine
+{
+
+ public sealed class DatabaseUpgradeResult
+ {
+ public DatabaseUpgradeResult(System.Collections.Generic.IEnumerable scripts, bool successful, System.Exception error) { }
+ public System.Exception Error { get; }
+ public System.Collections.Generic.IEnumerable Scripts { get; }
+ public bool Successful { get; }
+ }
+ public interface IJournal
+ {
+ string[] GetExecutedScripts();
+ void StoreExecutedScript(DbUp.Engine.SqlScript script);
+ }
+ public interface IScript
+ {
+ string ProvideScript(System.Func dbCommandFactory);
+ }
+ public interface IScriptExecutor
+ {
+ System.Nullable ExecutionTimeoutSeconds { get; set; }
+ void Execute(DbUp.Engine.SqlScript script);
+ void Execute(DbUp.Engine.SqlScript script, System.Collections.Generic.IDictionary variables);
+ void VerifySchema();
+ }
+ public interface IScriptPreprocessor
+ {
+ string Process(string contents);
+ }
+ public interface IScriptProvider
+ {
+ System.Collections.Generic.IEnumerable GetScripts(DbUp.Engine.Transactions.IConnectionManager connectionManager);
+ }
+ public class LazySqlScript : DbUp.Engine.SqlScript
+ {
+ public LazySqlScript(string name, System.Func contentProvider) { }
+ public override string Contents { get; }
+ }
+ public class SqlScript
+ {
+ public SqlScript(string name, string contents) { }
+ public virtual string Contents { get; }
+ public string Name { get; }
+ public static DbUp.Engine.SqlScript FromFile(string path) { }
+ public static DbUp.Engine.SqlScript FromStream(string scriptName, System.IO.Stream stream) { }
+ }
+ public class UpgradeEngine
+ {
+ public UpgradeEngine(DbUp.Builder.UpgradeConfiguration configuration) { }
+ public System.Collections.Generic.List GetScriptsToExecute() { }
+ public bool IsUpgradeRequired() { }
+ public DbUp.Engine.DatabaseUpgradeResult MarkAsExecuted() { }
+ public DbUp.Engine.DatabaseUpgradeResult PerformUpgrade() { }
+ public bool TryConnect(out string errorMessage) { }
+ }
+}
+namespace DbUp.Engine.Output
+{
+
+ public class ConsoleUpgradeLog : DbUp.Engine.Output.IUpgradeLog
+ {
+ public ConsoleUpgradeLog() { }
+ public void WriteError(string format, params object[] args) { }
+ public void WriteInformation(string format, params object[] args) { }
+ public void WriteWarning(string format, params object[] args) { }
+ }
+ public interface IUpgradeLog
+ {
+ void WriteError(string format, params object[] args);
+ void WriteInformation(string format, params object[] args);
+ void WriteWarning(string format, params object[] args);
+ }
+ public class TraceUpgradeLog : DbUp.Engine.Output.IUpgradeLog
+ {
+ public TraceUpgradeLog() { }
+ public void WriteError(string format, params object[] args) { }
+ public void WriteInformation(string format, params object[] args) { }
+ public void WriteWarning(string format, params object[] args) { }
+ }
+}
+namespace DbUp.Engine.Preprocessors
+{
+
+ public class StripSchemaPreprocessor : DbUp.Engine.IScriptPreprocessor
+ {
+ public StripSchemaPreprocessor() { }
+ public string Process(string contents) { }
+ }
+ public class VariableSubstitutionPreprocessor : DbUp.Engine.IScriptPreprocessor
+ {
+ public VariableSubstitutionPreprocessor(System.Collections.Generic.IDictionary variables) { }
+ public string Process(string contents) { }
+ }
+}
+namespace DbUp.Engine.Transactions
+{
+
+ public abstract class DatabaseConnectionManager : DbUp.Engine.Transactions.IConnectionManager
+ {
+ protected DatabaseConnectionManager() { }
+ public bool IsScriptOutputLogged { get; set; }
+ public DbUp.Engine.Transactions.TransactionMode TransactionMode { get; set; }
+ protected abstract System.Data.IDbConnection CreateConnection(DbUp.Engine.Output.IUpgradeLog log);
+ public void ExecuteCommandsWithManagedConnection(System.Action> action) { }
+ public T ExecuteCommandsWithManagedConnection(System.Func, T> actionWithResult) { }
+ public System.IDisposable OperationStarting(DbUp.Engine.Output.IUpgradeLog upgradeLog, System.Collections.Generic.List executedScripts) { }
+ public abstract System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents);
+ }
+ public interface IConnectionManager
+ {
+ bool IsScriptOutputLogged { get; set; }
+ DbUp.Engine.Transactions.TransactionMode TransactionMode { get; set; }
+ void ExecuteCommandsWithManagedConnection(System.Action> action);
+ T ExecuteCommandsWithManagedConnection(System.Func, T> actionWithResult);
+ System.IDisposable OperationStarting(DbUp.Engine.Output.IUpgradeLog upgradeLog, System.Collections.Generic.List executedScripts);
+ System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents);
+ }
+ public interface ITransactionStrategy : System.IDisposable
+ {
+ void Execute(System.Action> action);
+ T Execute(System.Func, T> actionWithResult);
+ void Initialise(System.Data.IDbConnection dbConnection, DbUp.Engine.Output.IUpgradeLog upgradeLog, System.Collections.Generic.List executedScripts);
+ }
+ public class LegacySqlConnectionManager : DbUp.Engine.Transactions.IConnectionManager
+ {
+ public LegacySqlConnectionManager(System.Func connectionFactory) { }
+ public bool IsScriptOutputLogged { get; set; }
+ public DbUp.Engine.Transactions.TransactionMode TransactionMode { get; set; }
+ public void ExecuteCommandsWithManagedConnection(System.Action> action) { }
+ public T ExecuteCommandsWithManagedConnection(System.Func, T> actionWithResult) { }
+ public System.IDisposable OperationStarting(DbUp.Engine.Output.IUpgradeLog upgradeLog, System.Collections.Generic.List executedScripts) { }
+ public System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { }
+ }
+ public enum TransactionMode
+ {
+ NoTransaction = 0,
+ SingleTransaction = 1,
+ TransactionPerScript = 2,
+ }
+}
+namespace DbUp.Helpers
+{
+
+ public class AdHocSqlRunner
+ {
+ public AdHocSqlRunner(System.Func commandFactory, string schema, params DbUp.Engine.IScriptPreprocessor[] additionalScriptPreprocessors) { }
+ public AdHocSqlRunner(System.Func commandFactory, string schema, System.Func variablesEnabled, params DbUp.Engine.IScriptPreprocessor[] additionalScriptPreprocessors) { }
+ public string Schema { get; set; }
+ public int ExecuteNonQuery(string query, params System.Func<, >[] parameters) { }
+ public System.Collections.Generic.List> ExecuteReader(string query, params System.Func<, >[] parameters) { }
+ public object ExecuteScalar(string query, params System.Func<, >[] parameters) { }
+ public DbUp.Helpers.AdHocSqlRunner WithVariable(string variableName, string value) { }
+ }
+ public class NullJournal : DbUp.Engine.IJournal
+ {
+ public NullJournal() { }
+ public string[] GetExecutedScripts() { }
+ public void StoreExecutedScript(DbUp.Engine.SqlScript script) { }
+ }
+ public class TemporarySqlDatabase : System.IDisposable
+ {
+ public TemporarySqlDatabase(string name) { }
+ public TemporarySqlDatabase(string name, string instanceName) { }
+ public DbUp.Helpers.AdHocSqlRunner AdHoc { get; }
+ public string ConnectionString { get; }
+ public void Create() { }
+ public void Dispose() { }
+ }
+}
+namespace DbUp.ScriptProviders
+{
+
+ public class EmbeddedScriptAndCodeProvider : DbUp.Engine.IScriptProvider
+ {
+ public EmbeddedScriptAndCodeProvider(System.Reflection.Assembly assembly, System.Func filter) { }
+ public System.Collections.Generic.IEnumerable GetScripts(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
+ }
+ public class EmbeddedScriptProvider : DbUp.Engine.IScriptProvider
+ {
+ public EmbeddedScriptProvider(System.Reflection.Assembly assembly, System.Func filter) { }
+ public System.Collections.Generic.IEnumerable GetScripts(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
+ }
+ public class FileSystemScriptProvider : DbUp.Engine.IScriptProvider
+ {
+ public FileSystemScriptProvider(string directoryPath) { }
+ public FileSystemScriptProvider(string directoryPath, System.Func filter) { }
+ public System.Collections.Generic.IEnumerable GetScripts(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
+ }
+ public sealed class StaticScriptProvider : DbUp.Engine.IScriptProvider
+ {
+ public StaticScriptProvider(System.Collections.Generic.IEnumerable scripts) { }
+ public System.Collections.Generic.IEnumerable GetScripts(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
+ }
+}
+namespace DbUp.Support.Firebird
+{
+
+ public sealed class FirebirdTableJournal : DbUp.Engine.IJournal
+ {
+ public FirebirdTableJournal(System.Func connectionManager, System.Func logger, string tableName) { }
+ public string[] GetExecutedScripts() { }
+ public void StoreExecutedScript(DbUp.Engine.SqlScript script) { }
+ }
+}
+namespace DbUp.Support.MySql
+{
+
+ public sealed class MySqlITableJournal : DbUp.Engine.IJournal
+ {
+ public MySqlITableJournal(System.Func connectionManager, System.Func logger, string schema, string table) { }
+ public string[] GetExecutedScripts() { }
+ public void StoreExecutedScript(DbUp.Engine.SqlScript script) { }
+ }
+}
+namespace DbUp.Support
+{
+
+ public enum ObjectNameOptions
+ {
+ None = 0,
+ Trim = 1,
+ }
+}
+namespace DbUp.Support.Postgresql
+{
+
+ public sealed class PostgresqlTableJournal : DbUp.Engine.IJournal
+ {
+ public PostgresqlTableJournal(System.Func connectionManager, System.Func logger, string schema, string table) { }
+ public string[] GetExecutedScripts() { }
+ public void StoreExecutedScript(DbUp.Engine.SqlScript script) { }
+ }
+}
+namespace DbUp.Support.SQLite
+{
+
+ public class SQLiteObjectParser
+ {
+ public SQLiteObjectParser() { }
+ public static string QuoteSqlObjectName(string objectName) { }
+ public static string QuoteSqlObjectName(string objectName, DbUp.Support.ObjectNameOptions objectNameOptions) { }
+ }
+ public sealed class SQLiteTableJournal : DbUp.Support.SqlServer.SqlTableJournal
+ {
+ public SQLiteTableJournal(System.Func connectionManager, System.Func logger, string table) { }
+ protected override string CreateTableSql(string tableName) { }
+ }
+}
+namespace DbUp.Support.SqlServer
+{
+
+ public class SqlCommandReader : System.IO.StringReader
+ {
+ public SqlCommandReader(string sqlText) { }
+ protected char CurrentChar { get; }
+ protected bool HasReachedEnd { get; }
+ protected bool IsEndOfLine { get; }
+ protected bool IsQuote { get; }
+ protected bool IsWhiteSpace { get; }
+ protected char LastChar { get; }
+ protected bool IsCharEqualTo(char comparisonChar, char compareTo) { }
+ protected bool IsCurrentCharEqualTo(char comparisonChar) { }
+ protected bool IsLastCharEqualTo(char comparisonChar) { }
+ protected char PeekChar() { }
+ public override int Read() { }
+ public void ReadAllCommands(System.Action handleCommand) { }
+ public string ReadCommand() { }
+ }
+ public class SqlCommandSplitter
+ {
+ public SqlCommandSplitter() { }
+ public virtual System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { }
+ }
+ public class SqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager
+ {
+ public SqlConnectionManager(string connectionString) { }
+ protected override System.Data.IDbConnection CreateConnection(DbUp.Engine.Output.IUpgradeLog log) { }
+ public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { }
+ }
+ public class SqlObjectParser
+ {
+ public SqlObjectParser() { }
+ public static string QuoteSqlObjectName(string objectName) { }
+ public static string QuoteSqlObjectName(string objectName, DbUp.Support.ObjectNameOptions objectNameOptions) { }
+ }
+ public sealed class SqlScriptExecutor : DbUp.Engine.IScriptExecutor
+ {
+ public SqlScriptExecutor(System.Func connectionManagerFactory, System.Func log, string schema, System.Func variablesEnabled, System.Collections.Generic.IEnumerable scriptPreprocessors) { }
+ public System.Nullable ExecutionTimeoutSeconds { get; set; }
+ public string Schema { get; set; }
+ public void Execute(DbUp.Engine.SqlScript script) { }
+ public void Execute(DbUp.Engine.SqlScript script, System.Collections.Generic.IDictionary variables) { }
+ public void VerifySchema() { }
+ }
+ public class SqlTableJournal : DbUp.Engine.IJournal
+ {
+ public SqlTableJournal(System.Func connectionManager, System.Func logger, string schema, string table) { }
+ protected virtual string CreateTableSql(string tableName) { }
+ public string[] GetExecutedScripts() { }
+ protected virtual string GetExecutedScriptsSql(string table) { }
+ public void StoreExecutedScript(DbUp.Engine.SqlScript script) { }
+ }
+}
+
+public class static SqlServerExtensions
+{
+ public static DbUp.Builder.UpgradeEngineBuilder JournalToSqlTable(this DbUp.Builder.UpgradeEngineBuilder builder, string schema, string table) { }
+ public static DbUp.Builder.UpgradeEngineBuilder SqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
+ public static DbUp.Builder.UpgradeEngineBuilder SqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { }
+ [System.ObsoleteAttribute("Pass connection string instead, then use .WithTransaction() and .WithTransactionP" +
+ "erScript() to manage connection behaviour")]
+ public static DbUp.Builder.UpgradeEngineBuilder SqlDatabase(this DbUp.Builder.SupportedDatabases supported, System.Func connectionFactory) { }
+ [System.ObsoleteAttribute("Pass connection string instead, then use .WithTransaction() and .WithTransactionP" +
+ "erScript() to manage connection behaviour")]
+ public static DbUp.Builder.UpgradeEngineBuilder SqlDatabase(this DbUp.Builder.SupportedDatabases supported, System.Func connectionFactory, string schema) { }
+}
+public class static StandardExtensions
+{
+ public static DbUp.Builder.UpgradeEngineBuilder JournalTo(this DbUp.Builder.UpgradeEngineBuilder builder, DbUp.Engine.IJournal journal) { }
+ public static DbUp.Builder.UpgradeEngineBuilder LogScriptOutput(this DbUp.Builder.UpgradeEngineBuilder builder) { }
+ public static DbUp.Builder.UpgradeEngineBuilder LogTo(this DbUp.Builder.UpgradeEngineBuilder builder, DbUp.Engine.Output.IUpgradeLog log) { }
+ public static DbUp.Builder.UpgradeEngineBuilder LogToConsole(this DbUp.Builder.UpgradeEngineBuilder builder) { }
+ public static DbUp.Builder.UpgradeEngineBuilder LogToTrace(this DbUp.Builder.UpgradeEngineBuilder builder) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithExecutionTimeout(this DbUp.Builder.UpgradeEngineBuilder builder, System.Nullable timeout) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithoutTransaction(this DbUp.Builder.UpgradeEngineBuilder builder) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithPreprocessor(this DbUp.Builder.UpgradeEngineBuilder builder, DbUp.Engine.IScriptPreprocessor preprocessor) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScript(this DbUp.Builder.UpgradeEngineBuilder builder, DbUp.Engine.SqlScript script) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScript(this DbUp.Builder.UpgradeEngineBuilder builder, string name, string contents) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScripts(this DbUp.Builder.UpgradeEngineBuilder builder, DbUp.Engine.IScriptProvider scriptProvider) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScripts(this DbUp.Builder.UpgradeEngineBuilder builder, System.Collections.Generic.IEnumerable scripts) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScripts(this DbUp.Builder.UpgradeEngineBuilder builder, params DbUp.Engine.SqlScript[] scripts) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScriptsAndCodeEmbeddedInAssembly(this DbUp.Builder.UpgradeEngineBuilder builder, System.Reflection.Assembly assembly) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScriptsAndCodeEmbeddedInAssembly(this DbUp.Builder.UpgradeEngineBuilder builder, System.Reflection.Assembly assembly, System.Func filter) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScriptsEmbeddedInAssembly(this DbUp.Builder.UpgradeEngineBuilder builder, System.Reflection.Assembly assembly) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScriptsEmbeddedInAssembly(this DbUp.Builder.UpgradeEngineBuilder builder, System.Reflection.Assembly assembly, System.Func filter) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScriptsFromFileSystem(this DbUp.Builder.UpgradeEngineBuilder builder, string path) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithScriptsFromFileSystem(this DbUp.Builder.UpgradeEngineBuilder builder, string path, System.Func filter) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithTransaction(this DbUp.Builder.UpgradeEngineBuilder builder) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithTransactionPerScript(this DbUp.Builder.UpgradeEngineBuilder builder) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithVariable(this DbUp.Builder.UpgradeEngineBuilder builder, string variableName, string value) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithVariables(this DbUp.Builder.UpgradeEngineBuilder builder, System.Collections.Generic.IDictionary variables) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithVariablesDisabled(this DbUp.Builder.UpgradeEngineBuilder builder) { }
+ public static DbUp.Builder.UpgradeEngineBuilder WithVariablesEnabled(this DbUp.Builder.UpgradeEngineBuilder builder) { }
+}
\ No newline at end of file
diff --git a/src/DbUp.Tests/packages.config b/src/DbUp.Tests/packages.config
index 167106c1..dfc68cdd 100644
--- a/src/DbUp.Tests/packages.config
+++ b/src/DbUp.Tests/packages.config
@@ -1,9 +1,14 @@
-
+
+
-
+
+
+
+
+
-
-
+
+
\ No newline at end of file
diff --git a/src/DbUp.v2.ncrunchsolution b/src/DbUp.v2.ncrunchsolution
new file mode 100644
index 00000000..05adb09d
--- /dev/null
+++ b/src/DbUp.v2.ncrunchsolution
@@ -0,0 +1,13 @@
+
+ 1
+ True
+ false
+ true
+ UseDynamicAnalysis
+ UseStaticAnalysis
+ UseStaticAnalysis
+ UseStaticAnalysis
+ Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk
+
+
+
\ No newline at end of file
diff --git a/src/DbUp/Builder/StandardExtensions.cs b/src/DbUp/Builder/StandardExtensions.cs
index 6743bc7d..cdb7cb38 100644
--- a/src/DbUp/Builder/StandardExtensions.cs
+++ b/src/DbUp/Builder/StandardExtensions.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
-using System.Reflection;
-using System.Text;
-using DbUp;
+using System.Reflection;
+using System.Text;
+using DbUp;
using DbUp.Builder;
using DbUp.Engine;
using DbUp.Engine.Output;
@@ -68,18 +68,18 @@ public static UpgradeEngineBuilder LogScriptOutput(this UpgradeEngineBuilder bui
public static UpgradeEngineBuilder LogToTrace(this UpgradeEngineBuilder builder)
{
return LogTo(builder, new TraceUpgradeLog());
- }
-
- ///
- /// Logs to SqlContext.Pipe, for use with "context connection=true".
- ///
- /// The builder.
- ///
- /// The same builder
- ///
- public static UpgradeEngineBuilder LogToSqlContext(this UpgradeEngineBuilder builder)
- {
- return LogTo(builder, new SqlContextUpgradeLog());
+ }
+
+ ///
+ /// Logs to SqlContext.Pipe, for use with "context connection=true".
+ ///
+ /// The builder.
+ ///
+ /// The same builder
+ ///
+ public static UpgradeEngineBuilder LogToSqlContext(this UpgradeEngineBuilder builder)
+ {
+ return LogTo(builder, new SqlContextUpgradeLog());
}
///
@@ -189,35 +189,35 @@ public static UpgradeEngineBuilder WithScriptsFromFileSystem(this UpgradeEngineB
public static UpgradeEngineBuilder WithScriptsFromFileSystem(this UpgradeEngineBuilder builder, string path, Func filter)
{
return WithScripts(builder, new FileSystemScriptProvider(path, filter));
- }
-
- ///
- /// Adds all scripts from a folder on the file system, with custom encoding.
- ///
- /// The builder.
- /// The directory path.
- /// The encoding.
- ///
- /// The same builder
- ///
- public static UpgradeEngineBuilder WithScriptsFromFileSystem(this UpgradeEngineBuilder builder, string path, Encoding encoding)
- {
- return WithScripts(builder, new FileSystemScriptProvider(path, encoding));
- }
-
- ///
- /// Adds all scripts from a folder on the file system, with a custom filter and custom encoding.
- ///
- /// The builder.
- /// The directory path.
- /// The filter. Use the static class to get some pre-defined filters.
- /// The encoding.
- ///
- /// The same builder
- ///
- public static UpgradeEngineBuilder WithScriptsFromFileSystem(this UpgradeEngineBuilder builder, string path, Func filter, Encoding encoding)
- {
- return WithScripts(builder, new FileSystemScriptProvider(path, filter, encoding));
+ }
+
+ ///
+ /// Adds all scripts from a folder on the file system, with custom encoding.
+ ///
+ /// The builder.
+ /// The directory path.
+ /// The encoding.
+ ///
+ /// The same builder
+ ///
+ public static UpgradeEngineBuilder WithScriptsFromFileSystem(this UpgradeEngineBuilder builder, string path, Encoding encoding)
+ {
+ return WithScripts(builder, new FileSystemScriptProvider(path, encoding));
+ }
+
+ ///
+ /// Adds all scripts from a folder on the file system, with a custom filter and custom encoding.
+ ///
+ /// The builder.
+ /// The directory path.
+ /// The filter. Use the static class to get some pre-defined filters.
+ /// The encoding.
+ ///
+ /// The same builder
+ ///
+ public static UpgradeEngineBuilder WithScriptsFromFileSystem(this UpgradeEngineBuilder builder, string path, Func filter, Encoding encoding)
+ {
+ return WithScripts(builder, new FileSystemScriptProvider(path, filter, encoding));
}
///
@@ -231,49 +231,49 @@ public static UpgradeEngineBuilder WithScriptsFromFileSystem(this UpgradeEngineB
public static UpgradeEngineBuilder WithScriptsEmbeddedInAssembly(this UpgradeEngineBuilder builder, Assembly assembly)
{
return WithScripts(builder, new EmbeddedScriptProvider(assembly, s => s.EndsWith(".sql", StringComparison.InvariantCultureIgnoreCase)));
- }
-
- ///
- /// Adds all scripts found as embedded resources in the given assembly, with custom encoding.
- ///
- /// The builder.
- /// The assembly.
- /// The encoding.
- ///
- /// The same builder
- ///
- public static UpgradeEngineBuilder WithScriptsEmbeddedInAssembly(this UpgradeEngineBuilder builder, Assembly assembly, Encoding encoding)
- {
- return WithScripts(builder, new EmbeddedScriptProvider(assembly, s => s.EndsWith(".sql", StringComparison.InvariantCultureIgnoreCase), encoding));
- }
-
- ///
- /// Adds all scripts found as embedded resources in the given assembly, with custom encoding and with a custom filter (you'll need to exclude non- .SQL files yourself).
- ///
- /// The builder.
- /// The assembly.
- /// The filter. Don't forget to ignore any non- .SQL files.
- /// The encoding.
- ///
- /// The same builder
- ///
+ }
+
+ ///
+ /// Adds all scripts found as embedded resources in the given assembly, with custom encoding.
+ ///
+ /// The builder.
+ /// The assembly.
+ /// The encoding.
+ ///
+ /// The same builder
+ ///
+ public static UpgradeEngineBuilder WithScriptsEmbeddedInAssembly(this UpgradeEngineBuilder builder, Assembly assembly, Encoding encoding)
+ {
+ return WithScripts(builder, new EmbeddedScriptProvider(assembly, s => s.EndsWith(".sql", StringComparison.InvariantCultureIgnoreCase), encoding));
+ }
+
+ ///
+ /// Adds all scripts found as embedded resources in the given assembly, with custom encoding and with a custom filter (you'll need to exclude non- .SQL files yourself).
+ ///
+ /// The builder.
+ /// The assembly.
+ /// The filter. Don't forget to ignore any non- .SQL files.
+ /// The encoding.
+ ///
+ /// The same builder
+ ///
public static UpgradeEngineBuilder WithScriptsEmbeddedInAssembly(this UpgradeEngineBuilder builder, Assembly assembly, Func filter, Encoding encoding)
{
return WithScripts(builder, new EmbeddedScriptProvider(assembly, filter, encoding));
- }
-
- ///
- /// Adds all scripts found as embedded resources in the given assembly, with a custom filter (you'll need to exclude non- .SQL files yourself).
- ///
- /// The builder.
- /// The assembly.
- /// The filter. Don't forget to ignore any non- .SQL files.
- ///
- /// The same builder
- ///
- public static UpgradeEngineBuilder WithScriptsEmbeddedInAssembly(this UpgradeEngineBuilder builder, Assembly assembly, Func filter)
- {
- return WithScripts(builder, new EmbeddedScriptProvider(assembly, filter));
+ }
+
+ ///
+ /// Adds all scripts found as embedded resources in the given assembly, with a custom filter (you'll need to exclude non- .SQL files yourself).
+ ///
+ /// The builder.
+ /// The assembly.
+ /// The filter. Don't forget to ignore any non- .SQL files.
+ ///
+ /// The same builder
+ ///
+ public static UpgradeEngineBuilder WithScriptsEmbeddedInAssembly(this UpgradeEngineBuilder builder, Assembly assembly, Func filter)
+ {
+ return WithScripts(builder, new EmbeddedScriptProvider(assembly, filter));
}
///
diff --git a/src/DbUp/DbUp.v2.ncrunchproject b/src/DbUp/DbUp.v2.ncrunchproject
new file mode 100644
index 00000000..8641d361
--- /dev/null
+++ b/src/DbUp/DbUp.v2.ncrunchproject
@@ -0,0 +1,19 @@
+
+ false
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ true
+ 60000
+
+
+ AutoDetect
+
\ No newline at end of file
diff --git a/src/DbUp/Engine/SqlScript.cs b/src/DbUp/Engine/SqlScript.cs
index 94167536..725cf12e 100644
--- a/src/DbUp/Engine/SqlScript.cs
+++ b/src/DbUp/Engine/SqlScript.cs
@@ -1,75 +1,75 @@
-
-using System.IO;
-using System.Text;
-
-namespace DbUp.Engine
-{
- ///
- /// Represents a SQL Server script that comes from an embedded resource in an assembly.
- ///
- public class SqlScript
- {
- private readonly string contents;
- private readonly string name;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The name.
- /// The contents.
- public SqlScript(string name, string contents)
- {
- this.name = name;
- this.contents = contents;
- }
-
- ///
- /// Gets the contents of the script.
- ///
- ///
- public virtual string Contents
- {
- get { return contents; }
- }
-
- ///
- /// Gets the name of the script.
- ///
- ///
- public string Name
- {
- get { return name; }
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- public static SqlScript FromFile(string path, Encoding encoding)
- {
- using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
- {
- var fileName = new FileInfo(path).Name;
- return FromStream(fileName, fileStream, encoding);
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static SqlScript FromStream(string scriptName, Stream stream, Encoding encoding)
- {
- using (var resourceStreamReader = new StreamReader(stream, encoding, true))
- {
- string c = resourceStreamReader.ReadToEnd();
- return new SqlScript(scriptName, c);
- }
- }
- }
+
+using System.IO;
+using System.Text;
+
+namespace DbUp.Engine
+{
+ ///
+ /// Represents a SQL Server script that comes from an embedded resource in an assembly.
+ ///
+ public class SqlScript
+ {
+ private readonly string contents;
+ private readonly string name;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name.
+ /// The contents.
+ public SqlScript(string name, string contents)
+ {
+ this.name = name;
+ this.contents = contents;
+ }
+
+ ///
+ /// Gets the contents of the script.
+ ///
+ ///
+ public virtual string Contents
+ {
+ get { return contents; }
+ }
+
+ ///
+ /// Gets the name of the script.
+ ///
+ ///
+ public string Name
+ {
+ get { return name; }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static SqlScript FromFile(string path, Encoding encoding)
+ {
+ using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
+ {
+ var fileName = new FileInfo(path).Name;
+ return FromStream(fileName, fileStream, encoding);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static SqlScript FromStream(string scriptName, Stream stream, Encoding encoding)
+ {
+ using (var resourceStreamReader = new StreamReader(stream, encoding, true))
+ {
+ string c = resourceStreamReader.ReadToEnd();
+ return new SqlScript(scriptName, c);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/DbUp/ScriptProviders/EmbeddedScriptProvider.cs b/src/DbUp/ScriptProviders/EmbeddedScriptProvider.cs
index b6aa01cc..2e273260 100644
--- a/src/DbUp/ScriptProviders/EmbeddedScriptProvider.cs
+++ b/src/DbUp/ScriptProviders/EmbeddedScriptProvider.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Reflection;
-using System.Text;
+using System.Reflection;
+using System.Text;
using DbUp.Engine;
using DbUp.Engine.Transactions;
@@ -14,9 +14,9 @@ namespace DbUp.ScriptProviders
public class EmbeddedScriptProvider : IScriptProvider
{
private readonly Assembly assembly;
- private readonly Func filter;
- private Encoding encoding;
-
+ private readonly Func filter;
+ private Encoding encoding;
+
///
/// Initializes a new instance of the class.
///
@@ -25,21 +25,21 @@ public class EmbeddedScriptProvider : IScriptProvider
public EmbeddedScriptProvider(Assembly assembly, Func filter)
{
this.assembly = assembly;
- this.filter = filter;
- this.encoding = Encoding.Default;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The assembly.
- /// The filter.
- /// The encoding.
- public EmbeddedScriptProvider(Assembly assembly, Func filter, Encoding encoding)
- {
- this.assembly = assembly;
- this.filter = filter;
- this.encoding = encoding;
+ this.filter = filter;
+ this.encoding = Encoding.Default;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The assembly.
+ /// The filter.
+ /// The encoding.
+ public EmbeddedScriptProvider(Assembly assembly, Func filter, Encoding encoding)
+ {
+ this.assembly = assembly;
+ this.filter = filter;
+ this.encoding = encoding;
}
///
diff --git a/src/DbUp/ScriptProviders/FileSystemScriptProvider.cs b/src/DbUp/ScriptProviders/FileSystemScriptProvider.cs
index 07c40a2c..67e21bfc 100644
--- a/src/DbUp/ScriptProviders/FileSystemScriptProvider.cs
+++ b/src/DbUp/ScriptProviders/FileSystemScriptProvider.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
-using System.Text;
+using System.Linq;
+using System.Text;
using DbUp.Engine;
using DbUp.Engine.Transactions;
@@ -14,7 +14,7 @@ namespace DbUp.ScriptProviders
public class FileSystemScriptProvider : IScriptProvider
{
private readonly string directoryPath;
- private readonly Func filter;
+ private readonly Func filter;
private readonly Encoding encoding;
///
@@ -23,8 +23,8 @@ public class FileSystemScriptProvider : IScriptProvider
public FileSystemScriptProvider(string directoryPath)
{
this.directoryPath = directoryPath;
- this.filter = null;
- this.encoding = Encoding.Default;
+ this.filter = null;
+ this.encoding = Encoding.Default;
}
///
@@ -34,38 +34,38 @@ public FileSystemScriptProvider(string directoryPath)
public FileSystemScriptProvider(string directoryPath, Func filter)
{
this.directoryPath = directoryPath;
- this.filter = filter;
+ this.filter = filter;
this.encoding = Encoding.Default;
- }
-
- ///
- ///
- ///Path to SQL upgrade scripts
- ///The encoding.
- public FileSystemScriptProvider(string directoryPath, Encoding encoding)
- {
- this.directoryPath = directoryPath;
- this.filter = null;
- this.encoding = encoding;
- }
-
- ///
- ///
- ///Path to SQL upgrade scripts
- ///The filter.
- ///The encoding.
- public FileSystemScriptProvider(string directoryPath, Func filter, Encoding encoding)
- {
- this.directoryPath = directoryPath;
- this.filter = filter;
- this.encoding = encoding;
+ }
+
+ ///
+ ///
+ ///Path to SQL upgrade scripts
+ ///The encoding.
+ public FileSystemScriptProvider(string directoryPath, Encoding encoding)
+ {
+ this.directoryPath = directoryPath;
+ this.filter = null;
+ this.encoding = encoding;
+ }
+
+ ///
+ ///
+ ///Path to SQL upgrade scripts
+ ///The filter.
+ ///The encoding.
+ public FileSystemScriptProvider(string directoryPath, Func filter, Encoding encoding)
+ {
+ this.directoryPath = directoryPath;
+ this.filter = filter;
+ this.encoding = encoding;
}
///
/// Gets all scripts that should be executed.
///
- public IEnumerable GetScripts(IConnectionManager connectionManager)
- {
+ public IEnumerable GetScripts(IConnectionManager connectionManager)
+ {
var files = Directory.GetFiles(directoryPath, "*.sql").AsEnumerable();
if (this.filter != null)
{
diff --git a/src/Information/SolutionInfo.cs b/src/Information/SolutionInfo.cs
index e29485cf..b0cdbf0e 100644
--- a/src/Information/SolutionInfo.cs
+++ b/src/Information/SolutionInfo.cs
@@ -5,6 +5,6 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("DbUp Contributors")]
[assembly: AssemblyProduct("DbUp")]
-[assembly: AssemblyCopyright("Copyright © DbUp Contributors 2010")]
+[assembly: AssemblyCopyright("Copyright © DbUp Contributors 2015")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
diff --git a/src/Samples/FirebirdSampleApplication/FirebirdSampleApplication.v2.ncrunchproject b/src/Samples/FirebirdSampleApplication/FirebirdSampleApplication.v2.ncrunchproject
new file mode 100644
index 00000000..cdfbdeb6
Binary files /dev/null and b/src/Samples/FirebirdSampleApplication/FirebirdSampleApplication.v2.ncrunchproject differ
diff --git a/src/Samples/SQLiteSampleApplication/SQLiteSampleApplication.v2.ncrunchproject b/src/Samples/SQLiteSampleApplication/SQLiteSampleApplication.v2.ncrunchproject
new file mode 100644
index 00000000..896f2193
--- /dev/null
+++ b/src/Samples/SQLiteSampleApplication/SQLiteSampleApplication.v2.ncrunchproject
@@ -0,0 +1,22 @@
+
+ false
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ true
+ 60000
+
+
+
+ AutoDetect
+ STA
+ x86
+
\ No newline at end of file
diff --git a/src/Samples/SampleApplication/SampleApplication.v2.ncrunchproject b/src/Samples/SampleApplication/SampleApplication.v2.ncrunchproject
new file mode 100644
index 00000000..8641d361
--- /dev/null
+++ b/src/Samples/SampleApplication/SampleApplication.v2.ncrunchproject
@@ -0,0 +1,19 @@
+
+ false
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ true
+ true
+ 60000
+
+
+ AutoDetect
+
\ No newline at end of file