Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,76 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this diff? Can you revert changes to the project file?

<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{80136911-3220-460B-867D-E1C94E241248}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DbUp.Support.SqlServer.Scripting.Console</RootNamespace>
<AssemblyName>DbUp.Support.SqlServer.Scripting.Console</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="dbup-core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=4b419c53bdfd4cbf">
<HintPath>../packages/dbup-core.4.1.0/lib/net45/dbup-core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="dbup-sqlserver, Version=4.1.0.0, Culture=neutral, PublicKeyToken=4b419c53bdfd4cbf">
<HintPath>../packages/dbup-sqlserver.4.1.0/lib/net35/dbup-sqlserver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DbUp.Support.SqlServer.Scripting\DbUp.Support.SqlServer.Scripting.csproj">
<Project>{a1ec7074-3c1d-4424-bc80-8bf770758774}</Project>
<Name>DbUp.Support.SqlServer.Scripting</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Scripts\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{80136911-3220-460B-867D-E1C94E241248}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DbUp.Support.SqlServer.Scripting.Console</RootNamespace>
<AssemblyName>DbUp.Support.SqlServer.Scripting.Console</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="dbup-core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=4b419c53bdfd4cbf">
<HintPath>../packages/dbup-core.4.1.0/lib/net45/dbup-core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="dbup-sqlserver, Version=4.1.0.0, Culture=neutral, PublicKeyToken=4b419c53bdfd4cbf">
<HintPath>../packages/dbup-sqlserver.4.1.0/lib/net35/dbup-sqlserver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.SqlServer.Smo, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DbUp.Support.SqlServer.Scripting\DbUp.Support.SqlServer.Scripting.csproj">
<Project>{a1ec7074-3c1d-4424-bc80-8bf770758774}</Project>
<Name>DbUp.Support.SqlServer.Scripting</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Scripts\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
14 changes: 13 additions & 1 deletion DbUp.Support.SqlServer.Scripting.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using DbUp.Support.SqlServer.Scripting;
using Microsoft.SqlServer.Management.Smo;

class Program
{
Expand All @@ -19,7 +21,17 @@ static int Main(string[] args)
.LogToConsole()
.Build();

ScriptingUpgrader upgradeScriptingEngine = new ScriptingUpgrader(connectionString, engine);
Options options = new Options()
{
ScriptingOptions = new ScriptingOptions()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than this being the default, and unable to be changed, can you use the same pattern as scriptAllDefinitions where it can be passed in as a arg?

See:
https://github.com/bradymholt/dbup-sqlserver-scripting/blob/master/DbUp.Support.SqlServer.Scripting/ScriptingUpgrader.cs#L105

{
ScriptBatchTerminator = true, //include 'GO' statements at the end of script batches
}
};

// args = new string[] { "--scriptAllDefinitions" };

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove.


ScriptingUpgrader upgradeScriptingEngine = new ScriptingUpgrader(connectionString, engine, options);
var result = upgradeScriptingEngine.Run(args);

if (!result.Successful)
Expand Down
4 changes: 4 additions & 0 deletions DbUp.Support.SqlServer.Scripting/DbObjectScripter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ private void SaveScript(ScriptObject scriptObject, StringCollection script, stri
{
sb.Append(str);
sb.Append(Environment.NewLine);
if (m_options.ScriptingOptions.ScriptBatchTerminator)
{
sb.Append("GO" + Environment.NewLine + Environment.NewLine);
}
}

m_log.WriteInformation(string.Format("Saving object definition: {0}", Path.Combine(outputDirectory, scriptObject.FileName)));
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Changes in this fork:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove these changes to the README?

1. Added support to follow **ScriptBatchTerminator** option so that "Go" statements are added at the end of script batches

For example
<pre>
Options options = new Options()
{
ScriptingOptions = new ScriptingOptions()
{
ScriptBatchTerminator = true, //include 'GO' statements at the end of script batches
}
};

ScriptingUpgrader upgradeScriptingEngine = new ScriptingUpgrader(connectionString, engine, options);
var result = upgradeScriptingEngine.Run(args);
</pre>

# DbUp SQL Server Object Scripting
[![NuGet version](https://badge.fury.io/nu/dbup-sqlserver-scripting.svg)](https://badge.fury.io/nu/dbup-sqlserver-scripting)

Expand Down