Skip to content

Commit d61f955

Browse files
authored
Merge pull request #9 from DbUp/release/6.0.0
Release 6.0
2 parents 546e49e + 85f00e9 commit d61f955

14 files changed

+77
-191
lines changed

.github/workflows/main.yml

+4-69
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,12 @@ name: CI
22

33
on:
44
push:
5+
branches:
6+
- '**' # Ignores pushes of tags
57
pull_request:
68
workflow_dispatch:
79

810
jobs:
911
build:
10-
runs-on: windows-latest # Use Ubuntu in v5.0
11-
12-
env:
13-
DOTNET_NOLOGO: true
14-
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache
15-
16-
steps:
17-
- uses: actions/checkout@v3
18-
with:
19-
fetch-depth: 0 # all
20-
21-
- name: Setup .NET 2.0 # Remove in v5.0
22-
uses: actions/setup-dotnet@v1
23-
with:
24-
dotnet-version: 2.0.x
25-
26-
- name: Setup .NET 8.0
27-
uses: actions/setup-dotnet@v1
28-
with:
29-
dotnet-version: 8.0.x
30-
31-
- name: Install GitVersion
32-
uses: gittools/actions/gitversion/setup@v0
33-
with:
34-
versionSpec: '5.x'
35-
36-
- name: Run GitVersion
37-
id: gitversion
38-
uses: gittools/actions/gitversion/execute@v0
39-
40-
- name: Display SemVer
41-
run: |
42-
echo "SemVer: $env:GitVersion_SemVer"
43-
44-
- name: Add DbUp NuGet Source
45-
run: dotnet nuget add source --name DbUp --username DbUp --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://nuget.pkg.github.com/DbUp/index.json
46-
47-
- name: Restore
48-
run: dotnet restore
49-
working-directory: src
50-
51-
- name: Build
52-
run: dotnet build -c Release --no-restore /p:Version=$env:GitVersion_SemVer
53-
working-directory: src
54-
55-
- name: Test
56-
run: dotnet test --no-build -c Release --logger trx --logger "console;verbosity=detailed" --results-directory ../artifacts
57-
working-directory: src
58-
59-
- name: Pack
60-
run: dotnet pack --no-build -c Release -o ../artifacts /p:Version=$env:GitVersion_SemVer
61-
working-directory: src
62-
63-
- name: Push NuGet packages to GitHub Packages ⬆️
64-
working-directory: artifacts
65-
run: dotnet nuget push *.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/DbUp/index.json"
66-
67-
- name: Push NuGet packages to NuGet ⬆️
68-
if: ${{ steps.gitversion.outputs.preReleaseLabel == '' }}
69-
working-directory: artifacts
70-
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json
71-
72-
- name: Test Report 🧪
73-
uses: dorny/test-reporter@v1
74-
if: ${{ always() }}
75-
with:
76-
name: Tests
77-
path: artifacts/*.trx
78-
reporter: dotnet-trx
12+
name: Build
13+
uses: DbUp/Universe/.github/workflows/build.yml@main

.github/workflows/publish-release.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Publish DbUp Packages to NuGet
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
name: Publish Package
11+
uses: DbUp/Universe/.github/workflows/publish-release.yml@main
12+
secrets: inherit

.github/workflows/test-report.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Test Report
2+
run-name: Generate Test Report for run `${{ github.event.workflow_run.run_number }}` branch `${{ github.event.workflow_run.head_branch }}`
3+
4+
on:
5+
workflow_run:
6+
workflows: ["CI", "build"]
7+
types: [completed]
8+
9+
jobs:
10+
report:
11+
name: Test Report 🧪
12+
uses: DbUp/Universe/.github/workflows/test-report.yml@main

src/Directory.Build.props

-14
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,4 @@
1010
<LangVersion>latest</LangVersion>
1111
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1212
</PropertyGroup>
13-
14-
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' Or '$(CI)' == 'true'">
15-
16-
<!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
17-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
18-
19-
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
20-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
21-
22-
<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
23-
<DebugType>embedded</DebugType>
24-
25-
</PropertyGroup>
26-
2713
</Project>

src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
DB Operation: Open connection
22
Info: Beginning database upgrade
3-
Info: Checking whether journal table exists..
3+
Info: Checking whether journal table exists
44
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
55
DB Operation: Dispose command
66
Info: Journal table does not exist
77
Info: Executing Database Server script 'Script0001.sql'
8-
Info: Checking whether journal table exists..
8+
Info: Checking whether journal table exists
99
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
1010
DB Operation: Dispose command
1111
Info: Creating the "schemaversions" table

src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
DB Operation: Open connection
22
Info: Beginning database upgrade
3-
Info: Checking whether journal table exists..
3+
Info: Checking whether journal table exists
44
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test'
55
DB Operation: Dispose command
66
Info: Journal table does not exist
77
Info: Executing Database Server script 'Script0001.sql'
8-
Info: Checking whether journal table exists..
8+
Info: Checking whether journal table exists
99
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test'
1010
DB Operation: Dispose command
1111
Info: Creating the "test"."TestSchemaVersions" table

src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
DB Operation: Open connection
22
Info: Beginning database upgrade
3-
Info: Checking whether journal table exists..
3+
Info: Checking whether journal table exists
44
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
55
DB Operation: Dispose command
66
Info: Journal table does not exist
77
Info: Executing Database Server script 'Script0001.sql'
8-
Info: Checking whether journal table exists..
8+
Info: Checking whether journal table exists
99
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
1010
DB Operation: Dispose command
1111
Info: Creating the "schemaversions" table

src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs

-45
This file was deleted.

src/Tests/Tests.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net462;net8</TargetFrameworks>
4+
<TargetFramework>net8</TargetFramework>
55
<AssemblyName>Tests</AssemblyName>
66
<RootNamespace>DbUp.Redshift.Tests</RootNamespace>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
8-
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
8+
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
1010
<NoWarn>$(NoWarn);NETSDK1138</NoWarn> <!-- Purposefully leaving an old version of netcoreapp to ensure we have compatibility. This never gets published -->
1111
<LangVersion>latest</LangVersion>
1212
</PropertyGroup>
1313

1414
<ItemGroup>
1515
<ProjectReference Include="..\dbup-redshift\dbup-redshift.csproj" />
16-
<PackageReference Include="DbUp.Tests.Common" Version="5.0.37" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
18-
<PackageReference Include="xunit" Version="2.6.6" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
16+
<PackageReference Include="DbUp.Tests.Common" Version="6.0.0-beta.146" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
18+
<PackageReference Include="xunit" Version="2.9.2" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
2020
<PrivateAssets>all</PrivateAssets>
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
</PackageReference>

src/dbup-redshift.sln.DotSettings

+3
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQ/@EntryIndexedValue">SQ</s:String>
66
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
77
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
8+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
9+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
10+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
811
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
912
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>

src/dbup-redshift/RedshiftExtensions.cs

+5-12
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,14 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
122122
logMasterConnectionStringBuilder.Password = "******";
123123
}
124124

125-
logger.WriteInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString);
125+
logger.LogInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString);
126126

127127
using (var connection = new NpgsqlConnection(masterConnectionStringBuilder.ConnectionString))
128128
{
129129
connection.Open();
130130

131-
var sqlCommandText = string.Format
132-
(
133-
@"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{0}' limit 1;",
134-
databaseName
135-
);
131+
var sqlCommandText =
132+
$@"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{databaseName}' limit 1;";
136133

137134

138135
// check to see if the database already exists..
@@ -150,11 +147,7 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
150147
}
151148
}
152149

153-
sqlCommandText = string.Format
154-
(
155-
"create database \"{0}\";",
156-
databaseName
157-
);
150+
sqlCommandText = $"create database \"{databaseName}\";";
158151

159152
// Create the database...
160153
using (var command = new NpgsqlCommand(sqlCommandText, connection)
@@ -166,7 +159,7 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
166159

167160
}
168161

169-
logger.WriteInformation(@"Created database {0}", databaseName);
162+
logger.LogInformation(@"Created database {0}", databaseName);
170163
}
171164
}
172165

src/dbup-redshift/RedshiftScriptExecutor.cs

+3-7
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,11 @@ protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScri
4040
{
4141
excuteCommand();
4242
}
43-
#if NPGSQLv2
44-
catch (NpgsqlException exception)
45-
#else
4643
catch (PostgresException exception)
47-
#endif
4844
{
49-
Log().WriteInformation("Npgsql exception has occured in script: '{0}'", script.Name);
50-
Log().WriteError("Script block number: {0}; Block line {1}; Position: {2}; Message: {3}", index, exception.Line, exception.Position, exception.Message);
51-
Log().WriteError(exception.ToString());
45+
Log().LogInformation("Npgsql exception has occured in script: '{0}'", script.Name);
46+
Log().LogError("Script block number: {0}; Block line {1}; Position: {2}; Message: {3}", index, exception.Line, exception.Position, exception.Message);
47+
Log().LogError(exception.ToString());
5248
throw;
5349
}
5450
}
+26-32
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<Description>DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds Amazon Redshift support.</Description>
5-
<Title>DbUp Redshift Support</Title>
6-
<TargetFrameworks>netstandard1.3;netstandard2.0;net35;net45</TargetFrameworks>
7-
<AssemblyName>dbup-redshift</AssemblyName>
8-
<RootNamespace>DbUp.Redshift</RootNamespace>
9-
<AssemblyOriginatorKeyFile>../dbup.snk</AssemblyOriginatorKeyFile>
10-
<SignAssembly>true</SignAssembly>
11-
<RepositoryUrl>https://github.com/DbUp/dbup-redshift.git</RepositoryUrl>
12-
<Product>dbup_redshift</Product>
13-
<PackageId>dbup-redshift</PackageId>
14-
<PackageIcon>dbup-icon.png</PackageIcon>
15-
</PropertyGroup>
3+
<PropertyGroup>
4+
<Description>DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds Amazon Redshift support.</Description>
5+
<Title>DbUp Redshift Support</Title>
6+
<TargetFramework>netstandard2.0</TargetFramework>
7+
<AssemblyName>dbup-redshift</AssemblyName>
8+
<RootNamespace>DbUp.Redshift</RootNamespace>
9+
<AssemblyOriginatorKeyFile>../dbup.snk</AssemblyOriginatorKeyFile>
10+
<SignAssembly>true</SignAssembly>
11+
<RepositoryUrl>https://github.com/DbUp/dbup-redshift.git</RepositoryUrl>
12+
<Product>dbup_redshift</Product>
13+
<PackageId>dbup-redshift</PackageId>
14+
<PackageIcon>dbup-icon.png</PackageIcon>
15+
</PropertyGroup>
1616

17-
<PropertyGroup Condition="'$(TargetFramework)' == 'net35'">
18-
<DefineConstants>$(DefineConstants);NPGSQLv2</DefineConstants>
19-
</PropertyGroup>
20-
21-
<ItemGroup>
22-
<PackageReference Include="dbup-core" Version="4.5.0" />
23-
</ItemGroup>
24-
25-
<ItemGroup Condition="'$(TargetFramework)' == 'net35'">
26-
<PackageReference Include="Npgsql" Version="2.2.7" /> <!-- Last version that supports .NET 3.5 -->
27-
</ItemGroup>
28-
29-
<ItemGroup Condition="'$(TargetFramework)' != 'net35'">
30-
<PackageReference Include="Npgsql" Version="3.2.6" />
31-
</ItemGroup>
32-
33-
<ItemGroup>
34-
<None Visible="false" Include="../dbup-icon.png" Pack="True" PackagePath="" />
35-
</ItemGroup>
17+
<PropertyGroup Condition="'$(CI)' == 'true'">
18+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> <!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
19+
<EmbedUntrackedSources>true</EmbedUntrackedSources> <!-- Embed source files that are not tracked by the source control manager in the PDB -->
20+
<DebugType>embedded</DebugType> <!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
21+
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<PackageReference Include="dbup-core" Version="6.0.3" />
25+
<PackageReference Include="Npgsql" Version="8.0.5" />
26+
</ItemGroup>
3627

28+
<ItemGroup>
29+
<None Visible="false" Include="../dbup-icon.png" Pack="True" PackagePath=""/>
30+
</ItemGroup>
3731
</Project>

0 commit comments

Comments
 (0)