Skip to content

Commit

Permalink
v2.5.3 (#54)
Browse files Browse the repository at this point in the history
- *Fixed:* Updated `CoreEx` to version `3.20.0`.
- *Fixed:* Fixed logging of SQL statements to include the source: `FILE`, `RES` (embedded resource) or `SQL` (specified statement).
  • Loading branch information
chullybun committed Jun 11, 2024
1 parent a1928b8 commit d69847a
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Represents the **NuGet** versions.

## v2.5.3
- *Fixed:* Updated `CoreEx` to version `3.20.0`.
- *Fixed:* Fixed logging of SQL statements to include the source: `FILE`, `RES` (embedded resource) or `SQL` (specified statement).

## v2.5.2
- *Fixed:* Updated `CoreEx` to version `3.18.0`.
- Includes removal of `Azure.Identity` dependency; related to `https://github.com/advisories/GHSA-wvxc-855f-jvrv`.
Expand Down
2 changes: 1 addition & 1 deletion Common.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.5.2</Version>
<Version>2.5.3</Version>
<LangVersion>preview</LangVersion>
<Authors>Avanade</Authors>
<Company>Avanade</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/DbEx.MySql/DbEx.MySql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.MySql" Version="3.18.0" />
<PackageReference Include="CoreEx.Database.MySql" Version="3.20.0" />
<PackageReference Include="dbup-mysql" Version="5.0.44" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/DbEx.Postgres/DbEx.Postgres.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.Postgres" Version="3.18.0" />
<PackageReference Include="CoreEx.Database.Postgres" Version="3.20.0" />
<PackageReference Include="dbup-postgresql" Version="5.0.40" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/DbEx.SqlServer/DbEx.SqlServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.18.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="3.20.0" />
<PackageReference Include="dbup-sqlserver" Version="5.0.40" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/DbEx/DbEx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx.Database" Version="3.18.0" />
<PackageReference Include="CoreEx.Database" Version="3.20.0" />
<PackageReference Include="OnRamp" Version="2.2.0" />
</ItemGroup>

Expand Down
5 changes: 2 additions & 3 deletions src/DbEx/Migration/DatabaseMigrationBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ protected virtual async Task<bool> ExecuteScriptsAsync(IEnumerable<DatabaseMigra
}

if (includeExecutionLogging)
Logger.LogInformation("{Content}", $" {script.Name}{(string.IsNullOrEmpty(script.Tag) ? "" : $" > {script.Tag}")}");
Logger.LogInformation("{Content}", $" {script.Name} ({script.Source}){(string.IsNullOrEmpty(script.Tag) ? "" : $" > {script.Tag}")}");

try
{
Expand Down Expand Up @@ -748,7 +748,7 @@ private async Task<bool> DatabaseDataAsync(CancellationToken cancellationToken)
Logger.LogInformation("{Content}", $"** Executing: {item.ResourceName}");

var ss = new DatabaseMigrationScript(this, item.Assembly, item.ResourceName) { RunAlways = true };
if (!await ExecuteScriptsAsync(new DatabaseMigrationScript[] { ss }, false, cancellationToken).ConfigureAwait(false))
if (!await ExecuteScriptsAsync([ss], false, cancellationToken).ConfigureAwait(false))
return false;
}
else
Expand Down Expand Up @@ -865,7 +865,6 @@ public async Task<bool> CreateScriptAsync(string? name = null, IDictionary<strin
/// </summary>
private async Task<bool> CreateScriptInternalAsync(string? name, IDictionary<string, string?>? parameters, CancellationToken cancellationToken)
{

name ??= "Default";
var rn = $"Script{name}_sql";

Expand Down
9 changes: 6 additions & 3 deletions src/DbEx/Migration/DatabaseMigrationScript.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/DbEx

using CoreEx;
using System;
using System.IO;
using System.Reflection;
using System.Text;
Expand Down Expand Up @@ -47,9 +46,8 @@ public DatabaseMigrationScript(DatabaseMigrationBase databaseMigation, Assembly
/// Initializes a new instance of the <see cref="DatabaseMigrationScript"/> class for the specified <paramref name="sql"/>.
/// </summary>
/// <param name="databaseMigation">The owning <see cref="DatabaseMigrationBase"/>.</param>
/// <param name="sql"></param>
/// <param name="sql">The SQL statement.</param>
/// <param name="name">The sql name.</param>
/// <exception cref="ArgumentNullException"></exception>
public DatabaseMigrationScript(DatabaseMigrationBase databaseMigation, string sql, string name)
{
DatabaseMigration = databaseMigation.ThrowIfNull(nameof(databaseMigation));
Expand Down Expand Up @@ -83,6 +81,11 @@ public DatabaseMigrationScript(DatabaseMigrationBase databaseMigation, string sq
/// </summary>
public string? Tag { get; set; }

/// <summary>
/// Gets the underlying SQL statement source.
/// </summary>
public string Source => _assembly is not null ? "RES" : (_file is not null ? "FILE" : "SQL");

/// <summary>
/// Gets the resource or file <see cref="System.IO.StreamReader"/>.
/// </summary>
Expand Down

0 comments on commit d69847a

Please sign in to comment.