Skip to content

Commit c465253

Browse files
droyadscrocqueselcampbellhardingdeasonshokurovnvierge-addactis
authored
Release 6.0 (#18)
* Add NpgsqlDataSource support to PostgresqlConnectionManager * Used new GHA workflows * Updated to dbup-core 6.0 beta, targeted netstandard2 and update Npgsql reference * Bump to the next beta of dbup-core * Merge fix * Removed stray #If * fix: #680 PostgreSQL statements split implemented (#19) * fix: #680 PostgreSQL statements split implemented Co-authored-by: shokurov <[email protected]> * Updated approval file --------- Co-authored-by: shokurov <[email protected]> Co-authored-by: Robert Wagner <[email protected]> * Update of libs * File scoped namespaces and primary ctors * Target `net8` so we can use the latest version of Npgsql (#24) * Target net8 so we can use the latest version of Npgsql * Used new APIs * Added Npgsql licence information (#25) * fix(#26): avoid NullReferenceException when creating database (#27) * fix(#26): avoid NullReferenceException when creating database * Updated approval file --------- Co-authored-by: Robert Wagner <[email protected]> * fix: fix delimiter parsing (#28) * Lowered Connection string printing to debug, resolves #30 --------- Co-authored-by: Sébastien Crocquesel <[email protected]> Co-authored-by: Campbell Harding-Deason <[email protected]> Co-authored-by: shokurov <[email protected]> Co-authored-by: nvierge-addactis <[email protected]>
1 parent a544ae5 commit c465253

25 files changed

+719
-353
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 69 deletions
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
Lines changed: 12 additions & 0 deletions
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

Lines changed: 12 additions & 0 deletions
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

Lines changed: 0 additions & 14 deletions
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 renamed to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt

Lines changed: 2 additions & 2 deletions
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
Lines changed: 2 additions & 2 deletions
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 renamed to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt

Lines changed: 2 additions & 2 deletions
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.DotNet.verified.cs

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs renamed to src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[assembly: System.CLSCompliantAttribute(true)]
1+
[assembly: System.CLSCompliantAttribute(false)]
22
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
33
[assembly: System.Runtime.InteropServices.GuidAttribute("5ddc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")]
44

@@ -16,20 +16,25 @@ public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatab
1616
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
1717
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
1818
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { }
19+
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
20+
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
1921
}
2022
namespace DbUp.Postgresql
2123
{
2224
public class PostgresqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager
2325
{
2426
public PostgresqlConnectionManager(string connectionString) { }
27+
public PostgresqlConnectionManager(Npgsql.NpgsqlDataSource datasource) { }
2528
public PostgresqlConnectionManager(string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
2629
public PostgresqlConnectionManager(string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
30+
public bool StandardConformingStrings { get; set; }
2731
public override System.Collections.Generic.IEnumerable<string> SplitScriptIntoCommands(string scriptContents) { }
2832
}
2933
public class PostgresqlConnectionOptions
3034
{
3135
public PostgresqlConnectionOptions() { }
3236
public System.Security.Cryptography.X509Certificates.X509Certificate2 ClientCertificate { get; set; }
37+
public string MasterDatabaseName { get; set; }
3338
public System.Net.Security.RemoteCertificateValidationCallback UserCertificateValidationCallback { get; set; }
3439
}
3540
public class PostgresqlObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser

src/Tests/DatabaseSupportTests.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#if !NETCORE
2-
using System;
3-
using DbUp.Builder;
1+
using DbUp.Builder;
42
using DbUp.Tests.Common;
53

64
namespace DbUp.Postgresql.Tests;
@@ -21,4 +19,3 @@ protected override UpgradeEngineBuilder AddCustomNamedJournalToBuilder(UpgradeEn
2119
=> new PostgresqlTableJournal(connectionManagerFactory, logFactory, schema, tableName)
2220
);
2321
}
24-
#endif

0 commit comments

Comments
 (0)