Skip to content

Commit 31d7eac

Browse files
authored
Merge branch 'main' into main
2 parents 3375b7e + 2ebbc1a commit 31d7eac

File tree

7 files changed

+67
-45
lines changed

7 files changed

+67
-45
lines changed
Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
1-
[assembly: System.CLSCompliantAttribute(false)]
2-
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
3-
[assembly: System.Runtime.InteropServices.GuidAttribute("5ddc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")]
4-
1+
[assembly: System.CLSCompliant(false)]
2+
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/DbUp/dbup-postgresql.git")]
3+
[assembly: System.Runtime.InteropServices.ComVisible(false)]
4+
[assembly: System.Runtime.InteropServices.Guid("5ddc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")]
5+
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")]
56
public static class PostgresqlExtensions
67
{
78
public static DbUp.Builder.UpgradeEngineBuilder JournalToPostgresqlTable(this DbUp.Builder.UpgradeEngineBuilder builder, string schema, string table) { }
89
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
9-
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
1010
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
11+
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
1112
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager, string schema) { }
12-
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { }
13-
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
14-
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
15-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString) { }
1613
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString) { }
17-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
18-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
19-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { }
20-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
21-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
14+
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString) { }
15+
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { }
2216
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { }
23-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
24-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
25-
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
17+
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
18+
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
19+
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { }
20+
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
21+
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
22+
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
23+
public static DbUp.Builder.UpgradeEngineBuilder PostgresqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
2624
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForDropDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
2725
public static void PostgresqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions, string owner) { }
2826
}
2927
namespace DbUp.Postgresql
3028
{
31-
public class PostgresqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager
29+
public class PostgresqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager
3230
{
33-
public PostgresqlConnectionManager(string connectionString) { }
3431
public PostgresqlConnectionManager(Npgsql.NpgsqlDataSource datasource) { }
35-
public PostgresqlConnectionManager(string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
32+
public PostgresqlConnectionManager(string connectionString) { }
3633
public PostgresqlConnectionManager(string connectionString, DbUp.Postgresql.PostgresqlConnectionOptions connectionOptions) { }
34+
public PostgresqlConnectionManager(string connectionString, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
3735
public bool StandardConformingStrings { get; set; }
3836
public override System.Collections.Generic.IEnumerable<string> SplitScriptIntoCommands(string scriptContents) { }
3937
}
@@ -44,7 +42,7 @@ public PostgresqlConnectionOptions() { }
4442
public string MasterDatabaseName { get; set; }
4543
public System.Net.Security.RemoteCertificateValidationCallback UserCertificateValidationCallback { get; set; }
4644
}
47-
public class PostgresqlObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser
45+
public class PostgresqlObjectParser : DbUp.Support.SqlObjectParser
4846
{
4947
public PostgresqlObjectParser() { }
5048
}
@@ -53,18 +51,18 @@ public class PostgresqlPreprocessor : DbUp.Engine.IScriptPreprocessor
5351
public PostgresqlPreprocessor() { }
5452
public string Process(string contents) { }
5553
}
56-
public class PostgresqlScriptExecutor : DbUp.Support.ScriptExecutor, DbUp.Engine.IScriptExecutor
54+
public class PostgresqlScriptExecutor : DbUp.Support.ScriptExecutor
5755
{
5856
public PostgresqlScriptExecutor(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManagerFactory, System.Func<DbUp.Engine.Output.IUpgradeLog> log, string schema, System.Func<bool> variablesEnabled, System.Collections.Generic.IEnumerable<DbUp.Engine.IScriptPreprocessor> scriptPreprocessors, System.Func<DbUp.Engine.IJournal> journalFactory) { }
5957
protected override void ExecuteCommandsWithinExceptionHandler(int index, DbUp.Engine.SqlScript script, System.Action executeCommand) { }
6058
protected override string GetVerifySchemaSql(string schema) { }
6159
}
62-
public class PostgresqlTableJournal : DbUp.Support.TableJournal, DbUp.Engine.IJournal
60+
public class PostgresqlTableJournal : DbUp.Support.TableJournal
6361
{
6462
public PostgresqlTableJournal(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManager, System.Func<DbUp.Engine.Output.IUpgradeLog> logger, string schema, string tableName) { }
6563
protected override string CreateSchemaTableSql(string quotedPrimaryKeyName) { }
6664
protected override string GetInsertJournalEntrySql(string scriptName, string applied) { }
6765
protected override System.Data.IDbCommand GetInsertScriptCommand(System.Func<System.Data.IDbCommand> dbCommandFactory, DbUp.Engine.SqlScript script) { }
6866
protected override string GetJournalEntriesSql() { }
6967
}
70-
}
68+
}

src/Tests/Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
<ItemGroup>
1212
<ProjectReference Include="..\dbup-postgresql\dbup-postgresql.csproj"/>
13-
<PackageReference Include="DbUp.Tests.Common" Version="6.0.4" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
15-
<PackageReference Include="xunit" Version="2.9.2" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
13+
<PackageReference Include="DbUp.Tests.Common" Version="6.0.15" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
15+
<PackageReference Include="xunit" Version="2.9.3" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
</PackageReference>

src/dbup-postgresql/PostgresqlExtensions.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Data;
33
using System.Security.Cryptography.X509Certificates;
44
using System.Text.RegularExpressions;
@@ -166,7 +166,7 @@ public static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase s
166166
}
167167

168168
/// <summary>
169-
/// Ensures that the database specified in the connection string exists.
169+
/// Ensures that the database specified in the connection string exists using SSL for the connection.
170170
/// </summary>
171171
/// <param name="supported">Fluent helper type.</param>
172172
/// <param name="connectionString">The connection string.</param>
@@ -183,12 +183,12 @@ public static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase s
183183
}
184184

185185
/// <summary>
186-
/// Ensures that the database specified in the connection string exists.
186+
/// Ensures that the database specified in the connection string exists using SSL for the connection.
187187
/// </summary>
188188
/// <param name="supported">Fluent helper type.</param>
189189
/// <param name="connectionString">The connection string.</param>
190190
/// <param name="logger">The <see cref="DbUp.Engine.Output.IUpgradeLog"/> used to record actions.</param>
191-
/// <param name="connectionOptions">Connection SSL to customize SSL behaviour</param>
191+
/// <param name="connectionOptions">Connection options to set SSL parameters</param>
192192
public static void PostgresqlDatabase(
193193
this SupportedDatabasesForEnsureDatabase supported,
194194
string connectionString,
@@ -344,6 +344,13 @@ public static void PostgresqlDatabase(this SupportedDatabasesForDropDatabase sup
344344
PostgresqlDatabase(supported, connectionString, logger, new PostgresqlConnectionOptions());
345345
}
346346

347+
/// <summary>
348+
/// Drops the database specified in the connection string if it exists using SSL for the connection.
349+
/// </summary>
350+
/// <param name="supported">Fluent helper type.</param>
351+
/// <param name="connectionString">The connection string.</param>
352+
/// <param name="logger">The <see cref="DbUp.Engine.Output.IUpgradeLog"/> used to record actions.</param>
353+
/// <param name="certificate">Certificate for securing connection.</param>
347354
public static void PostgresqlDatabase(this SupportedDatabasesForDropDatabase supported, string connectionString, IUpgradeLog logger, X509Certificate2 certificate)
348355
{
349356
var options = new PostgresqlConnectionOptions
@@ -353,6 +360,13 @@ public static void PostgresqlDatabase(this SupportedDatabasesForDropDatabase sup
353360
PostgresqlDatabase(supported, connectionString, logger, options);
354361
}
355362

363+
/// <summary>
364+
/// Drops the database specified in the connection string if it exists using SSL for the connection.
365+
/// </summary>
366+
/// <param name="supported">Fluent helper type.</param>
367+
/// <param name="connectionString">The connection string.</param>
368+
/// <param name="logger">The <see cref="DbUp.Engine.Output.IUpgradeLog"/> used to record actions.</param>
369+
/// <param name="connectionOptions">Connection options to set SSL parameters</param>
356370
public static void PostgresqlDatabase(
357371
this SupportedDatabasesForDropDatabase supported,
358372
string connectionString,
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
using DbUp.Support;
1+
using DbUp.Support;
22

33
namespace DbUp.Postgresql;
44

55
/// <summary>
66
/// Parses Sql Objects and performs quoting functions.
77
/// </summary>
8+
/// <remarks>
9+
/// Initializes a new instance of the <see cref="PostgresqlObjectParser"/> class.
10+
/// </remarks>
811
public class PostgresqlObjectParser() : SqlObjectParser("\"", "\"");

src/dbup-postgresql/PostgresqlScriptExecutor.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using DbUp.Engine;
44
using DbUp.Engine.Output;
@@ -25,12 +25,14 @@ public class PostgresqlScriptExecutor : ScriptExecutor
2525
public PostgresqlScriptExecutor(Func<IConnectionManager> connectionManagerFactory, Func<IUpgradeLog> log, string schema, Func<bool> variablesEnabled,
2626
IEnumerable<IScriptPreprocessor> scriptPreprocessors, Func<IJournal> journalFactory)
2727
: base(connectionManagerFactory, new PostgresqlObjectParser(), log, schema, variablesEnabled, scriptPreprocessors, journalFactory)
28-
{
29-
}
28+
{
29+
}
3030

31-
protected override string GetVerifySchemaSql(string schema) => $"CREATE SCHEMA IF NOT EXISTS {schema}";
31+
/// <inheritdoc/>
32+
protected override string GetVerifySchemaSql(string schema) => $"CREATE SCHEMA IF NOT EXISTS {schema}";
3233

33-
protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScript script, Action executeCommand)
34+
/// <inheritdoc/>
35+
protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScript script, Action executeCommand)
3436
{
3537
try
3638
{

src/dbup-postgresql/PostgresqlTableJournal.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Data;
33
using DbUp.Engine;
44
using DbUp.Engine.Output;
@@ -22,10 +22,11 @@ public class PostgresqlTableJournal : TableJournal
2222
/// <param name="tableName">The name of the journal table.</param>
2323
public PostgresqlTableJournal(Func<IConnectionManager> connectionManager, Func<IUpgradeLog> logger, string schema, string tableName)
2424
: base(connectionManager, logger, new PostgresqlObjectParser(), schema, tableName)
25-
{
26-
}
25+
{
26+
}
2727

28-
protected override IDbCommand GetInsertScriptCommand(Func<IDbCommand> dbCommandFactory, SqlScript script)
28+
/// <inheritdoc/>
29+
protected override IDbCommand GetInsertScriptCommand(Func<IDbCommand> dbCommandFactory, SqlScript script)
2930
{
3031
// EnableSqlRewriting is enabled by default, and needs to be explicitly disabled
3132
bool enableSqlRewriting = !AppContext.TryGetSwitch("Npgsql.EnableSqlRewriting", out bool enabled) || enabled;
@@ -49,16 +50,19 @@ protected override IDbCommand GetInsertScriptCommand(Func<IDbCommand> dbCommandF
4950
return command;
5051
}
5152

53+
/// <inheritdoc/>
5254
protected override string GetInsertJournalEntrySql(string scriptName, string applied)
5355
{
5456
return $"insert into {FqSchemaTableName} (ScriptName, Applied) values ({scriptName}, {applied})";
5557
}
5658

59+
/// <inheritdoc/>
5760
protected override string GetJournalEntriesSql()
5861
{
5962
return $"select ScriptName from {FqSchemaTableName} order by ScriptName";
6063
}
6164

65+
/// <inheritdoc/>
6266
protected override string CreateSchemaTableSql(string quotedPrimaryKeyName)
6367
{
6468
return

src/dbup-postgresql/dbup-postgresql.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Description>DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds PostgreSQL support.</Description>
@@ -14,6 +14,7 @@
1414
<SignAssembly>true</SignAssembly>
1515
<RepositoryUrl>https://github.com/DbUp/dbup-postgresql.git</RepositoryUrl>
1616
<PackageIcon>dbup-icon.png</PackageIcon>
17+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1718
</PropertyGroup>
1819

1920
<PropertyGroup Condition="'$(CI)' == 'true'">
@@ -23,15 +24,15 @@
2324
</PropertyGroup>
2425

2526
<ItemGroup>
26-
<PackageReference Include="dbup-core" Version="6.0.4" />
27+
<PackageReference Include="dbup-core" Version="6.0.15" />
2728
</ItemGroup>
2829

2930
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
3031
<PackageReference Include="Npgsql" Version="8.0.7" />
3132
</ItemGroup>
3233

3334
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
34-
<PackageReference Include="Npgsql" Version="9.0.3" />
35+
<PackageReference Include="Npgsql" Version="9.0.4" />
3536
</ItemGroup>
3637

3738
<ItemGroup>

0 commit comments

Comments
 (0)