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 e6df8c2..bae8f52 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