From 43552b1a2f2ce31fbd800e3ebef13de541a5301c Mon Sep 17 00:00:00 2001 From: Robert Wagner Date: Thu, 6 Nov 2025 14:30:36 +1000 Subject: [PATCH 1/3] dbup-core v6.0.15 update (#39) * dbup-core v6.0.13 * Test.Common update which included changes to the Surface area test file layout --- .../NoPublicApiChanges.Run.approved.cs | 49 ++++++++++--------- src/Tests/Tests.csproj | 8 +-- src/dbup-postgresql/dbup-postgresql.csproj | 2 +- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs index d7c8f73..b3131dc 100644 --- a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs +++ b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs @@ -1,38 +1,39 @@ -[assembly: System.CLSCompliantAttribute(false)] -[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly: System.Runtime.InteropServices.GuidAttribute("5ddc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")] - +[assembly: System.CLSCompliant(false)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/DbUp/dbup-postgresql.git")] +[assembly: System.Runtime.InteropServices.ComVisible(false)] +[assembly: System.Runtime.InteropServices.Guid("5ddc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] public static class PostgresqlExtensions { public static DbUp.Builder.UpgradeEngineBuilder JournalToPostgresqlTable(this DbUp.Builder.UpgradeEngineBuilder builder, string schema, string table) { } public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { } - public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { } public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.Engine.Transactions.IConnectionManager connectionManager) { } + public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { } public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager, string schema) { } - public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { } - public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } - public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString) { } public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString) { } + public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { } public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } - public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } + public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } + public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } } namespace DbUp.Postgresql { - public class PostgresqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager + public class PostgresqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager { - public PostgresqlConnectionManager(string connectionString) { } public PostgresqlConnectionManager(Npgsql.NpgsqlDataSource datasource) { } - public PostgresqlConnectionManager(string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public PostgresqlConnectionManager(string connectionString) { } public PostgresqlConnectionManager(string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { } + public PostgresqlConnectionManager(string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } public bool StandardConformingStrings { get; set; } public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { } } @@ -43,7 +44,7 @@ public PostgresqlConnectionOptions() { } public string MasterDatabaseName { get; set; } public System.Net.Security.RemoteCertificateValidationCallback UserCertificateValidationCallback { get; set; } } - public class PostgresqlObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser + public class PostgresqlObjectParser : DbUp.Support.SqlObjectParser { public PostgresqlObjectParser() { } } @@ -52,13 +53,13 @@ public class PostgresqlPreprocessor : DbUp.Engine.IScriptPreprocessor public PostgresqlPreprocessor() { } public string Process(string contents) { } } - public class PostgresqlScriptExecutor : DbUp.Support.ScriptExecutor, DbUp.Engine.IScriptExecutor + public class PostgresqlScriptExecutor : DbUp.Support.ScriptExecutor { public PostgresqlScriptExecutor(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 executeCommand) { } protected override string GetVerifySchemaSql(string schema) { } } - public class PostgresqlTableJournal : DbUp.Support.TableJournal, DbUp.Engine.IJournal + public class PostgresqlTableJournal : DbUp.Support.TableJournal { public PostgresqlTableJournal(System.Func connectionManager, System.Func logger, string schema, string tableName) { } protected override string CreateSchemaTableSql(string quotedPrimaryKeyName) { } @@ -66,4 +67,4 @@ protected override string GetInsertJournalEntrySql(string scriptName, string app protected override System.Data.IDbCommand GetInsertScriptCommand(System.Func dbCommandFactory, DbUp.Engine.SqlScript script) { } protected override string GetJournalEntriesSql() { } } -} +} \ No newline at end of file diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 83295fe..22618f0 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -10,10 +10,10 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/dbup-postgresql/dbup-postgresql.csproj b/src/dbup-postgresql/dbup-postgresql.csproj index e6df8c2..37ea4e1 100644 --- a/src/dbup-postgresql/dbup-postgresql.csproj +++ b/src/dbup-postgresql/dbup-postgresql.csproj @@ -23,7 +23,7 @@ - + From 90187141a409da7ec7e9f922f7e69712e5967a00 Mon Sep 17 00:00:00 2001 From: Robert Wagner Date: Thu, 6 Nov 2025 14:30:48 +1000 Subject: [PATCH 2/3] Add XML documentation for all public members (#36) --- src/dbup-postgresql/PostgresqlExtensions.cs | 30 ++++++++++++++++++- src/dbup-postgresql/PostgresqlObjectParser.cs | 5 +++- .../PostgresqlScriptExecutor.cs | 12 ++++---- src/dbup-postgresql/PostgresqlTableJournal.cs | 12 +++++--- src/dbup-postgresql/dbup-postgresql.csproj | 3 +- 5 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/dbup-postgresql/PostgresqlExtensions.cs b/src/dbup-postgresql/PostgresqlExtensions.cs index 42dbcaa..8c965ab 100644 --- a/src/dbup-postgresql/PostgresqlExtensions.cs +++ b/src/dbup-postgresql/PostgresqlExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Data; using System.Security.Cryptography.X509Certificates; using System.Text.RegularExpressions; @@ -165,6 +165,13 @@ public static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase s PostgresqlDatabase(supported, connectionString, logger, new PostgresqlConnectionOptions()); } + /// + /// Ensures that the database specified in the connection string exists using SSL for the connection. + /// + /// Fluent helper type. + /// The connection string. + /// The used to record actions. + /// Certificate for securing connection. public static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase supported, string connectionString, IUpgradeLog logger, X509Certificate2 certificate) { var options = new PostgresqlConnectionOptions @@ -174,6 +181,13 @@ public static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase s PostgresqlDatabase(supported, connectionString, logger, options); } + /// + /// Ensures that the database specified in the connection string exists using SSL for the connection. + /// + /// Fluent helper type. + /// The connection string. + /// The used to record actions. + /// Connection options to set SSL parameters public static void PostgresqlDatabase( this SupportedDatabasesForEnsureDatabase supported, string connectionString, @@ -292,6 +306,13 @@ public static void PostgresqlDatabase(this SupportedDatabasesForDropDatabase sup PostgresqlDatabase(supported, connectionString, logger, new PostgresqlConnectionOptions()); } + /// + /// Drops the database specified in the connection string if it exists using SSL for the connection. + /// + /// Fluent helper type. + /// The connection string. + /// The used to record actions. + /// Certificate for securing connection. public static void PostgresqlDatabase(this SupportedDatabasesForDropDatabase supported, string connectionString, IUpgradeLog logger, X509Certificate2 certificate) { var options = new PostgresqlConnectionOptions @@ -301,6 +322,13 @@ public static void PostgresqlDatabase(this SupportedDatabasesForDropDatabase sup PostgresqlDatabase(supported, connectionString, logger, options); } + /// + /// Drops the database specified in the connection string if it exists using SSL for the connection. + /// + /// Fluent helper type. + /// The connection string. + /// The used to record actions. + /// Connection options to set SSL parameters public static void PostgresqlDatabase( this SupportedDatabasesForDropDatabase supported, string connectionString, diff --git a/src/dbup-postgresql/PostgresqlObjectParser.cs b/src/dbup-postgresql/PostgresqlObjectParser.cs index 7e5cc44..96d2eb8 100644 --- a/src/dbup-postgresql/PostgresqlObjectParser.cs +++ b/src/dbup-postgresql/PostgresqlObjectParser.cs @@ -1,8 +1,11 @@ -using DbUp.Support; +using DbUp.Support; namespace DbUp.Postgresql; /// /// Parses Sql Objects and performs quoting functions. /// +/// +/// Initializes a new instance of the class. +/// public class PostgresqlObjectParser() : SqlObjectParser("\"", "\""); diff --git a/src/dbup-postgresql/PostgresqlScriptExecutor.cs b/src/dbup-postgresql/PostgresqlScriptExecutor.cs index 78d4766..5a8c657 100644 --- a/src/dbup-postgresql/PostgresqlScriptExecutor.cs +++ b/src/dbup-postgresql/PostgresqlScriptExecutor.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using DbUp.Engine; using DbUp.Engine.Output; @@ -25,12 +25,14 @@ public class PostgresqlScriptExecutor : ScriptExecutor public PostgresqlScriptExecutor(Func connectionManagerFactory, Func log, string schema, Func variablesEnabled, IEnumerable scriptPreprocessors, Func journalFactory) : base(connectionManagerFactory, new PostgresqlObjectParser(), log, schema, variablesEnabled, scriptPreprocessors, journalFactory) - { - } + { + } - protected override string GetVerifySchemaSql(string schema) => $"CREATE SCHEMA IF NOT EXISTS {schema}"; + /// + protected override string GetVerifySchemaSql(string schema) => $"CREATE SCHEMA IF NOT EXISTS {schema}"; - protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScript script, Action executeCommand) + /// + protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScript script, Action executeCommand) { try { diff --git a/src/dbup-postgresql/PostgresqlTableJournal.cs b/src/dbup-postgresql/PostgresqlTableJournal.cs index fc35160..1fe0e0f 100644 --- a/src/dbup-postgresql/PostgresqlTableJournal.cs +++ b/src/dbup-postgresql/PostgresqlTableJournal.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Data; using DbUp.Engine; using DbUp.Engine.Output; @@ -22,10 +22,11 @@ public class PostgresqlTableJournal : TableJournal /// The name of the journal table. public PostgresqlTableJournal(Func connectionManager, Func logger, string schema, string tableName) : base(connectionManager, logger, new PostgresqlObjectParser(), schema, tableName) - { - } + { + } - protected override IDbCommand GetInsertScriptCommand(Func dbCommandFactory, SqlScript script) + /// + protected override IDbCommand GetInsertScriptCommand(Func dbCommandFactory, SqlScript script) { // EnableSqlRewriting is enabled by default, and needs to be explicitly disabled bool enableSqlRewriting = !AppContext.TryGetSwitch("Npgsql.EnableSqlRewriting", out bool enabled) || enabled; @@ -49,16 +50,19 @@ protected override IDbCommand GetInsertScriptCommand(Func dbCommandF return command; } + /// protected override string GetInsertJournalEntrySql(string scriptName, string applied) { return $"insert into {FqSchemaTableName} (ScriptName, Applied) values ({scriptName}, {applied})"; } + /// protected override string GetJournalEntriesSql() { return $"select ScriptName from {FqSchemaTableName} order by ScriptName"; } + /// protected override string CreateSchemaTableSql(string quotedPrimaryKeyName) { return diff --git a/src/dbup-postgresql/dbup-postgresql.csproj b/src/dbup-postgresql/dbup-postgresql.csproj index 37ea4e1..1352fce 100644 --- a/src/dbup-postgresql/dbup-postgresql.csproj +++ b/src/dbup-postgresql/dbup-postgresql.csproj @@ -1,4 +1,4 @@ - + DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds PostgreSQL support. @@ -14,6 +14,7 @@ true https://github.com/DbUp/dbup-postgresql.git dbup-icon.png + true From 2ebbc1a1b5e6a0e9ff21b5b02327975dbea97581 Mon Sep 17 00:00:00 2001 From: Robert Wagner Date: Thu, 6 Nov 2025 14:31:38 +1000 Subject: [PATCH 3/3] Update Other Dependencies (#38) --- src/dbup-postgresql/dbup-postgresql.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbup-postgresql/dbup-postgresql.csproj b/src/dbup-postgresql/dbup-postgresql.csproj index 1352fce..f5c7eef 100644 --- a/src/dbup-postgresql/dbup-postgresql.csproj +++ b/src/dbup-postgresql/dbup-postgresql.csproj @@ -32,7 +32,7 @@ - +