From 0a2148f48b38f5e7a19f4dec32b42ed39134809f Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Tue, 17 Feb 2026 15:22:58 -0500 Subject: [PATCH] Use DuckDbInitializer.CurrentSchemaVersion in tests instead of hardcoded value Made CurrentSchemaVersion internal and added InternalsVisibleTo so the test project references the constant directly. Schema bumps no longer require updating tests. Co-Authored-By: Claude Opus 4.6 --- Lite.Tests/DuckDbSchemaTests.cs | 4 ++-- Lite/Database/DuckDbInitializer.cs | 2 +- Lite/PerformanceMonitorLite.csproj | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Lite.Tests/DuckDbSchemaTests.cs b/Lite.Tests/DuckDbSchemaTests.cs index 170c8d36..e8415ab5 100644 --- a/Lite.Tests/DuckDbSchemaTests.cs +++ b/Lite.Tests/DuckDbSchemaTests.cs @@ -96,7 +96,7 @@ public async Task InitializeAsync_SetsCorrectSchemaVersion() cmd.CommandText = "SELECT MAX(version) FROM schema_version"; var version = Convert.ToInt32(await cmd.ExecuteScalarAsync()); - Assert.Equal(10, version); + Assert.Equal(DuckDbInitializer.CurrentSchemaVersion, version); } [Fact] @@ -115,7 +115,7 @@ public async Task InitializeAsync_IsIdempotent() cmd.CommandText = "SELECT MAX(version) FROM schema_version"; var version = Convert.ToInt32(await cmd.ExecuteScalarAsync()); - Assert.Equal(10, version); + Assert.Equal(DuckDbInitializer.CurrentSchemaVersion, version); } [Fact] diff --git a/Lite/Database/DuckDbInitializer.cs b/Lite/Database/DuckDbInitializer.cs index a288429a..13e7874b 100644 --- a/Lite/Database/DuckDbInitializer.cs +++ b/Lite/Database/DuckDbInitializer.cs @@ -19,7 +19,7 @@ public class DuckDbInitializer /// /// Current schema version. Increment this when schema changes require table rebuilds. /// - private const int CurrentSchemaVersion = 10; + internal const int CurrentSchemaVersion = 10; public DuckDbInitializer(string databasePath, ILogger? logger = null) { diff --git a/Lite/PerformanceMonitorLite.csproj b/Lite/PerformanceMonitorLite.csproj index 60686279..b9b7f369 100644 --- a/Lite/PerformanceMonitorLite.csproj +++ b/Lite/PerformanceMonitorLite.csproj @@ -27,6 +27,10 @@ CA1849;CA2007;CA1508;CA1822;CA1805;CA1510;CA1816;CA1861;CA1845;CA2201;CS4014;NU1701;CA1001;CA1848;CA1852;CA1305;CA1860;CA1707;CA1507;CA1806 + + + +