diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 18198a1..26798d9 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -2,77 +2,12 @@ name: CI
on:
push:
+ branches:
+ - '**' # Ignores pushes of tags
pull_request:
workflow_dispatch:
jobs:
build:
- runs-on: windows-latest # Use Ubuntu in v5.0
-
- env:
- DOTNET_NOLOGO: true
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache
-
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0 # all
-
- - name: Setup .NET 2.0 # Remove in v5.0
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 2.0.x
-
- - name: Setup .NET 8.0
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 8.0.x
-
- - name: Install GitVersion
- uses: gittools/actions/gitversion/setup@v0
- with:
- versionSpec: '5.x'
-
- - name: Run GitVersion
- id: gitversion
- uses: gittools/actions/gitversion/execute@v0
-
- - name: Display SemVer
- run: |
- echo "SemVer: $env:GitVersion_SemVer"
-
- - name: Add DbUp NuGet Source
- 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
-
- - name: Restore
- run: dotnet restore
- working-directory: src
-
- - name: Build
- run: dotnet build -c Release --no-restore /p:Version=$env:GitVersion_SemVer
- working-directory: src
-
- - name: Test
- run: dotnet test --no-build -c Release --logger trx --logger "console;verbosity=detailed" --results-directory ../artifacts
- working-directory: src
-
- - name: Pack
- run: dotnet pack --no-build -c Release -o ../artifacts /p:Version=$env:GitVersion_SemVer
- working-directory: src
-
- - name: Push NuGet packages to GitHub Packages ⬆️
- working-directory: artifacts
- run: dotnet nuget push *.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/DbUp/index.json"
-
- - name: Push NuGet packages to NuGet ⬆️
- if: ${{ steps.gitversion.outputs.preReleaseLabel == '' }}
- working-directory: artifacts
- run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json
-
- - name: Test Report 🧪
- uses: dorny/test-reporter@v1
- if: ${{ always() }}
- with:
- name: Tests
- path: artifacts/*.trx
- reporter: dotnet-trx
+ name: Build
+ uses: DbUp/Universe/.github/workflows/build.yml@main
diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
new file mode 100644
index 0000000..eb5e03f
--- /dev/null
+++ b/.github/workflows/publish-release.yml
@@ -0,0 +1,12 @@
+name: Publish DbUp Packages to NuGet
+
+on:
+ release:
+ types: [ published ]
+ workflow_dispatch:
+
+jobs:
+ publish:
+ name: Publish Package
+ uses: DbUp/Universe/.github/workflows/publish-release.yml@main
+ secrets: inherit
diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml
new file mode 100644
index 0000000..e8c9f8f
--- /dev/null
+++ b/.github/workflows/test-report.yml
@@ -0,0 +1,12 @@
+name: Test Report
+run-name: Generate Test Report for run `${{ github.event.workflow_run.run_number }}` branch `${{ github.event.workflow_run.head_branch }}`
+
+on:
+ workflow_run:
+ workflows: ["CI", "build"]
+ types: [completed]
+
+jobs:
+ report:
+ name: Test Report 🧪
+ uses: DbUp/Universe/.github/workflows/test-report.yml@main
\ No newline at end of file
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index f3a3a06..c2554b1 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -10,18 +10,4 @@
latest
true
-
-
-
-
- true
-
-
- true
-
-
- embedded
-
-
-
diff --git a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt
similarity index 92%
rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt
rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt
index b2efe85..1c26cb7 100644
--- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt
+++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
-Info: Checking whether journal table exists..
+Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
-Info: Checking whether journal table exists..
+Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Creating the "schemaversions" table
diff --git a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt
similarity index 93%
rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt
rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt
index 17625f2..bf50dd8 100644
--- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt
+++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
-Info: Checking whether journal table exists..
+Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
-Info: Checking whether journal table exists..
+Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test'
DB Operation: Dispose command
Info: Creating the "test"."TestSchemaVersions" table
diff --git a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt
similarity index 92%
rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt
rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt
index 2854ff2..c4898b2 100644
--- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt
+++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
-Info: Checking whether journal table exists..
+Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
-Info: Checking whether journal table exists..
+Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Creating the "schemaversions" table
diff --git a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs
deleted file mode 100644
index 65bb0bd..0000000
--- a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-[assembly: System.CLSCompliantAttribute(true)]
-[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
-[assembly: System.Runtime.InteropServices.GuidAttribute("abcc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")]
-
-public static class RedshiftExtensions
-{
- public static DbUp.Builder.UpgradeEngineBuilder JournalToRedshiftTable(this DbUp.Builder.UpgradeEngineBuilder builder, string schema, string table) { }
- public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
- public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
- public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
- public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager, string schema) { }
- public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { }
- public static void RedshiftDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString) { }
- public static void RedshiftDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { }
-}
-namespace DbUp.Redshift
-{
- public class RedshiftConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager
- {
- public RedshiftConnectionManager(string connectionString) { }
- public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { }
- }
- public class RedshiftObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser
- {
- public RedshiftObjectParser() { }
- }
- public class RedshiftPreprocessor : DbUp.Engine.IScriptPreprocessor
- {
- public RedshiftPreprocessor() { }
- public string Process(string contents) { }
- }
- public class RedshiftScriptExecutor : DbUp.Support.ScriptExecutor, DbUp.Engine.IScriptExecutor
- {
- public RedshiftScriptExecutor(System.Func connectionManagerFactory, System.Func log, string schema, System.Func variablesEnabled, System.Collections.Generic.IEnumerable scriptPreprocessors, System.Func journalFactory) { }
- protected override void ExecuteCommandsWithinExceptionHandler(int index, DbUp.Engine.SqlScript script, System.Action excuteCommand) { }
- protected override string GetVerifySchemaSql(string schema) { }
- }
- public class RedshiftTableJournal : DbUp.Support.TableJournal, DbUp.Engine.IJournal
- {
- public RedshiftTableJournal(System.Func connectionManager, System.Func logger, string schema, string tableName) { }
- protected override string CreateSchemaTableSql(string quotedPrimaryKeyName) { }
- protected override string GetInsertJournalEntrySql(string scriptName, string applied) { }
- protected override string GetJournalEntriesSql() { }
- }
-}
diff --git a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.DotNet.verified.cs b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs
similarity index 100%
rename from src/Tests/ApprovalFiles/NoPublicApiChanges.Run.DotNet.verified.cs
rename to src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs
diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj
index f211f1a..b6b7d78 100644
--- a/src/Tests/Tests.csproj
+++ b/src/Tests/Tests.csproj
@@ -1,11 +1,11 @@
- net462;net8
+ net8
Tests
DbUp.Redshift.Tests
true
-
+ enable
enable
$(NoWarn);NETSDK1138
latest
@@ -13,10 +13,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/dbup-redshift.sln.DotSettings b/src/dbup-redshift.sln.DotSettings
index 2c78c0a..d3334fb 100644
--- a/src/dbup-redshift.sln.DotSettings
+++ b/src/dbup-redshift.sln.DotSettings
@@ -5,5 +5,8 @@
SQ
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ True
<data><IncludeFilters /><ExcludeFilters /></data>
<data />
\ No newline at end of file
diff --git a/src/dbup-redshift/RedshiftExtensions.cs b/src/dbup-redshift/RedshiftExtensions.cs
index 63d873d..b3041fb 100644
--- a/src/dbup-redshift/RedshiftExtensions.cs
+++ b/src/dbup-redshift/RedshiftExtensions.cs
@@ -122,17 +122,14 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
logMasterConnectionStringBuilder.Password = "******";
}
- logger.WriteInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString);
+ logger.LogInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString);
using (var connection = new NpgsqlConnection(masterConnectionStringBuilder.ConnectionString))
{
connection.Open();
- var sqlCommandText = string.Format
- (
- @"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{0}' limit 1;",
- databaseName
- );
+ var sqlCommandText =
+ $@"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{databaseName}' limit 1;";
// check to see if the database already exists..
@@ -150,11 +147,7 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
}
}
- sqlCommandText = string.Format
- (
- "create database \"{0}\";",
- databaseName
- );
+ sqlCommandText = $"create database \"{databaseName}\";";
// Create the database...
using (var command = new NpgsqlCommand(sqlCommandText, connection)
@@ -166,7 +159,7 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
}
- logger.WriteInformation(@"Created database {0}", databaseName);
+ logger.LogInformation(@"Created database {0}", databaseName);
}
}
diff --git a/src/dbup-redshift/RedshiftScriptExecutor.cs b/src/dbup-redshift/RedshiftScriptExecutor.cs
index 43bdaf1..187100f 100644
--- a/src/dbup-redshift/RedshiftScriptExecutor.cs
+++ b/src/dbup-redshift/RedshiftScriptExecutor.cs
@@ -40,15 +40,11 @@ protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScri
{
excuteCommand();
}
-#if NPGSQLv2
- catch (NpgsqlException exception)
-#else
catch (PostgresException exception)
-#endif
{
- Log().WriteInformation("Npgsql exception has occured in script: '{0}'", script.Name);
- Log().WriteError("Script block number: {0}; Block line {1}; Position: {2}; Message: {3}", index, exception.Line, exception.Position, exception.Message);
- Log().WriteError(exception.ToString());
+ Log().LogInformation("Npgsql exception has occured in script: '{0}'", script.Name);
+ Log().LogError("Script block number: {0}; Block line {1}; Position: {2}; Message: {3}", index, exception.Line, exception.Position, exception.Message);
+ Log().LogError(exception.ToString());
throw;
}
}
diff --git a/src/dbup-redshift/dbup-redshift.csproj b/src/dbup-redshift/dbup-redshift.csproj
index 42c94b7..6a113f7 100644
--- a/src/dbup-redshift/dbup-redshift.csproj
+++ b/src/dbup-redshift/dbup-redshift.csproj
@@ -1,37 +1,31 @@
-
- DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds Amazon Redshift support.
- DbUp Redshift Support
- netstandard1.3;netstandard2.0;net35;net45
- dbup-redshift
- DbUp.Redshift
- ../dbup.snk
- true
- https://github.com/DbUp/dbup-redshift.git
- dbup_redshift
- dbup-redshift
- dbup-icon.png
-
+
+ DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds Amazon Redshift support.
+ DbUp Redshift Support
+ netstandard2.0
+ dbup-redshift
+ DbUp.Redshift
+ ../dbup.snk
+ true
+ https://github.com/DbUp/dbup-redshift.git
+ dbup_redshift
+ dbup-redshift
+ dbup-icon.png
+
-
- $(DefineConstants);NPGSQLv2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ true
+ true
+ embedded
+
+
+
+
+
+
+
+
+