diff --git a/CHANGELOG.md b/CHANGELOG.md index 6556b58..f9c3722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/Common.targets b/Common.targets index 520b159..14e8a61 100644 --- a/Common.targets +++ b/Common.targets @@ -1,6 +1,6 @@ - 2.5.2 + 2.5.3 preview Avanade Avanade diff --git a/src/DbEx.MySql/DbEx.MySql.csproj b/src/DbEx.MySql/DbEx.MySql.csproj index 992a74e..cb835e1 100644 --- a/src/DbEx.MySql/DbEx.MySql.csproj +++ b/src/DbEx.MySql/DbEx.MySql.csproj @@ -41,7 +41,7 @@ - + diff --git a/src/DbEx.Postgres/DbEx.Postgres.csproj b/src/DbEx.Postgres/DbEx.Postgres.csproj index 4ad0144..342d035 100644 --- a/src/DbEx.Postgres/DbEx.Postgres.csproj +++ b/src/DbEx.Postgres/DbEx.Postgres.csproj @@ -42,7 +42,7 @@ - + diff --git a/src/DbEx.SqlServer/DbEx.SqlServer.csproj b/src/DbEx.SqlServer/DbEx.SqlServer.csproj index 6e15deb..6165ae0 100644 --- a/src/DbEx.SqlServer/DbEx.SqlServer.csproj +++ b/src/DbEx.SqlServer/DbEx.SqlServer.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/DbEx/DbEx.csproj b/src/DbEx/DbEx.csproj index 9532996..90e4725 100644 --- a/src/DbEx/DbEx.csproj +++ b/src/DbEx/DbEx.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/DbEx/Migration/DatabaseMigrationBase.cs b/src/DbEx/Migration/DatabaseMigrationBase.cs index ee767a3..76eb4e4 100644 --- a/src/DbEx/Migration/DatabaseMigrationBase.cs +++ b/src/DbEx/Migration/DatabaseMigrationBase.cs @@ -343,7 +343,7 @@ protected virtual async Task ExecuteScriptsAsync(IEnumerable {script.Tag}")}"); + Logger.LogInformation("{Content}", $" {script.Name} ({script.Source}){(string.IsNullOrEmpty(script.Tag) ? "" : $" > {script.Tag}")}"); try { @@ -748,7 +748,7 @@ private async Task 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 @@ -865,7 +865,6 @@ public async Task CreateScriptAsync(string? name = null, IDictionary private async Task CreateScriptInternalAsync(string? name, IDictionary? parameters, CancellationToken cancellationToken) { - name ??= "Default"; var rn = $"Script{name}_sql"; diff --git a/src/DbEx/Migration/DatabaseMigrationScript.cs b/src/DbEx/Migration/DatabaseMigrationScript.cs index 04ea008..7a40448 100644 --- a/src/DbEx/Migration/DatabaseMigrationScript.cs +++ b/src/DbEx/Migration/DatabaseMigrationScript.cs @@ -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; @@ -47,9 +46,8 @@ public DatabaseMigrationScript(DatabaseMigrationBase databaseMigation, Assembly /// Initializes a new instance of the class for the specified . /// /// The owning . - /// + /// The SQL statement. /// The sql name. - /// public DatabaseMigrationScript(DatabaseMigrationBase databaseMigation, string sql, string name) { DatabaseMigration = databaseMigation.ThrowIfNull(nameof(databaseMigation)); @@ -83,6 +81,11 @@ public DatabaseMigrationScript(DatabaseMigrationBase databaseMigation, string sq /// public string? Tag { get; set; } + /// + /// Gets the underlying SQL statement source. + /// + public string Source => _assembly is not null ? "RES" : (_file is not null ? "FILE" : "SQL"); + /// /// Gets the resource or file . ///