Support SAP HANA via Sap.Data.Hana.Net.v8.0 and Sap.Data.Hana.Net.v10.0 NuGet packages#2277
Conversation
…ana.Net.v10.0 Agent-Logs-Url: https://github.com/fluentmigrator/fluentmigrator/sessions/11b1dc5c-3e63-4f1a-a1d1-7c5b00b0fa2d Co-authored-by: jzabroski <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR modernizes FluentMigrator’s SAP HANA support by removing the previously bundled lib/Hana driver binaries and shifting to a NuGet-driven model, introducing version-specific registration helpers (AddHana8() / AddHana10()) while keeping AddHana() for backwards compatibility (now obsolete).
Changes:
- Introduces
AddHana8()andAddHana10()runner registration helpers and updates HANA factory probing to includeSap.Data.Hana.v8.0/Sap.Data.Hana.v10.0. - Removes HANA “support will go away” obsoletions across IDs and HANA runner types; marks the legacy
AddHana()API as[Obsolete]. - Removes repo-bundled HANA DLL/content references and updates tests/docs to use the new registration approach.
Reviewed changes
Copilot reviewed 28 out of 46 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/FluentMigrator.Tests/Unit/Runners/DatabaseIdentifierTests.cs | Updates unit runner setup to register HANA via AddHana8(). |
| test/FluentMigrator.Tests/Integration/Processors/Hana/HanaTableTests.cs | Uses AddHana8() in HANA integration test setup. |
| test/FluentMigrator.Tests/Integration/Processors/Hana/HanaSequenceTests.cs | Uses AddHana8() in HANA integration test setup. |
| test/FluentMigrator.Tests/Integration/Processors/Hana/HanaSchemaTests.cs | Uses AddHana8() in HANA integration test setup. |
| test/FluentMigrator.Tests/Integration/Processors/Hana/HanaSchemaExtensionsTests.cs | Uses AddHana8() in HANA integration test setup. |
| test/FluentMigrator.Tests/Integration/Processors/Hana/HanaProcessorTests.cs | Uses AddHana8() in HANA integration test setup (preview mode too). |
| test/FluentMigrator.Tests/Integration/Processors/Hana/HanaIndexTests.cs | Uses AddHana8() in HANA integration test setup. |
| test/FluentMigrator.Tests/Integration/Processors/Hana/HanaConstraintTests.cs | Uses AddHana8() in HANA integration test setup. |
| test/FluentMigrator.Tests/Integration/Processors/Hana/HanaColumnTests.cs | Uses AddHana8() in HANA integration test setup. |
| test/FluentMigrator.Tests/Integration/Processors/Hana/EndToEnd/HanaTestEndToEnd.cs | Uses AddHana8() in end-to-end HANA test wiring. |
| test/FluentMigrator.Tests/Helpers/HanaTestTable.cs | Switches test helper to ADO.NET interfaces; updates command creation pattern. |
| test/FluentMigrator.Tests/Helpers/HanaTestSequence.cs | Switches test helper to ADO.NET interfaces; updates command creation pattern. |
| test/FluentMigrator.Tests/FluentMigrator.Tests.csproj | Removes references/content-copy of bundled HANA driver binaries. |
| src/FluentMigrator/ProcessorId.cs | Removes HANA deprecation [Obsolete] attributes on processor IDs. |
| src/FluentMigrator/GeneratorIdConstants.cs | Removes HANA deprecation [Obsolete] attribute on generator IDs. |
| src/FluentMigrator.Runner/FluentMigrationRunnerBuilderExtensions.cs | Removes HANA from AddAllDatabases() registration list. |
| src/FluentMigrator.Runner.Hana/Processors/Hana/HanaProcessor.cs | Removes HANA deprecation [Obsolete] attribute on processor type. |
| src/FluentMigrator.Runner.Hana/Processors/Hana/HanaDbFactory.cs | Adds reflection test entries for Sap.Data.Hana.v8.0 / Sap.Data.Hana.v10.0. |
| src/FluentMigrator.Runner.Hana/HanaRunnerBuilderExtensions.cs | Adds AddHana8()/AddHana10(); marks legacy AddHana() obsolete; refactors shared registration. |
| src/FluentMigrator.Runner.Hana/Generators/Hana/IHanaTypeMap.cs | Removes HANA deprecation [Obsolete] attribute on interface. |
| src/FluentMigrator.Runner.Hana/Generators/Hana/HanaTypeMap.cs | Removes HANA deprecation [Obsolete] attribute on type map. |
| src/FluentMigrator.Runner.Hana/Generators/Hana/HanaQuoter.cs | Removes HANA deprecation [Obsolete] attribute on quoter. |
| src/FluentMigrator.Runner.Hana/Generators/Hana/HanaGenerator.cs | Removes HANA deprecation [Obsolete] attribute on generator. |
| src/FluentMigrator.Runner.Hana/Generators/Hana/HanaDescriptionGenerator.cs | Removes HANA deprecation [Obsolete] attribute and unused System using. |
| src/FluentMigrator.Console/FluentMigrator.Console.csproj | Removes bundled HANA DLL/content references from console project. |
| lib/Hana/ado.net/v4.5/SSDLToHana.tt | Removes bundled HANA-related template from repo. |
| lib/Hana/ado.net/v3.5/Sap.Data.Hana.v3.5.xml | Removes bundled HANA XML docs from repo. |
| lib/Hana/ado.net/v3.5/Sap.Data.Hana.v3.5.dll.config | Removes bundled HANA config from repo. |
| docs-website/providers/others.md | Updates HANA docs to install the correct driver NuGet and use AddHana8()/AddHana10(). |
| [Obsolete("Use AddHana8() for .NET 8 with the Sap.Data.Hana.Net.v8.0 NuGet package, or AddHana10() for .NET 10 with the Sap.Data.Hana.Net.v10.0 NuGet package.")] | ||
| public static IMigrationRunnerBuilder AddHana(this IMigrationRunnerBuilder builder) | ||
| { | ||
| return builder.RegisterHanaServices(); | ||
| } |
There was a problem hiding this comment.
Remove AddHana from src/FluentMigrator.Console/MigratorConsole.cs:477 and src/FluentMigrator.MSBuild/Migrate.cs:265 - .NET Framework support for Hana is dropped. Update CHANGELOG.md to reflect this. src/FluentMigrator.DotNet.Cli/Setup.cs:82 should use well-known MSBuild pre-processor symbols:
#if NET8_0
.AddHana8()
#elif NET9_0
.AddHana8()
#elif NET10_0_OR_GREATER
.AddHana10()
#endifThere was a problem hiding this comment.
Fixed in 3188f77: removed HANA registration from MigratorConsole and Migrate, updated Setup to use the requested NET8_0/NET9_0/NET10_0_OR_GREATER symbols, and added the changelog entry.
| var indexName = string.Format("idx_{0}", column); | ||
|
|
||
| var quotedObjectName = _quoter.QuoteTableName(Name); | ||
|
|
||
| var quotedIndexName = _quoter.QuoteIndexName(indexName); | ||
|
|
||
| using (var command = new HanaCommand(string.Format("CREATE INDEX {0} ON {1} ({2})", quotedIndexName, quotedObjectName, _quoter.QuoteColumnName(column)), Connection, Transaction)) | ||
| using (var command = Connection.CreateCommand()) | ||
| { | ||
| command.CommandText = string.Format("CREATE INDEX {0} ON {1} ({2})", quotedIndexName, quotedObjectName, _quoter.QuoteColumnName(column)); |
There was a problem hiding this comment.
Fixed in 3188f77: HanaTestTable.WithIndexOn() now schema-qualifies the target table so schema-based index existence tests use the correct object.
| For .NET 8, use `AddHana8()`: | ||
|
|
||
| ```csharp | ||
| services.AddFluentMigratorCore() | ||
| .ConfigureRunner(rb => rb | ||
| .AddHana8() | ||
| .WithGlobalConnectionString(connectionString) | ||
| .ScanIn(Assembly.GetExecutingAssembly()).For.Migrations()) | ||
| .AddLogging(lb => lb.AddFluentMigratorConsole()); | ||
| ``` |
There was a problem hiding this comment.
@copilot Update docs-website/intro/configuration.md (line 55) to use AddHana8, AddHana10
There was a problem hiding this comment.
Fixed in 3188f77: docs-website/intro/configuration.md now lists AddHana8() and AddHana10() with their corresponding SAP HANA driver packages.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
jzabroski
left a comment
There was a problem hiding this comment.
Please address feedback.
| For .NET 8, use `AddHana8()`: | ||
|
|
||
| ```csharp | ||
| services.AddFluentMigratorCore() | ||
| .ConfigureRunner(rb => rb | ||
| .AddHana8() | ||
| .WithGlobalConnectionString(connectionString) | ||
| .ScanIn(Assembly.GetExecutingAssembly()).For.Migrations()) | ||
| .AddLogging(lb => lb.AddFluentMigratorConsole()); | ||
| ``` |
There was a problem hiding this comment.
@copilot Update docs-website/intro/configuration.md (line 55) to use AddHana8, AddHana10
| [Obsolete("Use AddHana8() for .NET 8 with the Sap.Data.Hana.Net.v8.0 NuGet package, or AddHana10() for .NET 10 with the Sap.Data.Hana.Net.v10.0 NuGet package.")] | ||
| public static IMigrationRunnerBuilder AddHana(this IMigrationRunnerBuilder builder) | ||
| { | ||
| return builder.RegisterHanaServices(); | ||
| } |
There was a problem hiding this comment.
Remove AddHana from src/FluentMigrator.Console/MigratorConsole.cs:477 and src/FluentMigrator.MSBuild/Migrate.cs:265 - .NET Framework support for Hana is dropped. Update CHANGELOG.md to reflect this. src/FluentMigrator.DotNet.Cli/Setup.cs:82 should use well-known MSBuild pre-processor symbols:
#if NET8_0
.AddHana8()
#elif NET9_0
.AddHana8()
#elif NET10_0_OR_GREATER
.AddHana10()
#endif| var indexName = string.Format("idx_{0}", column); | ||
|
|
||
| var quotedObjectName = _quoter.QuoteTableName(Name); | ||
|
|
||
| var quotedIndexName = _quoter.QuoteIndexName(indexName); | ||
|
|
||
| using (var command = new HanaCommand(string.Format("CREATE INDEX {0} ON {1} ({2})", quotedIndexName, quotedObjectName, _quoter.QuoteColumnName(column)), Connection, Transaction)) | ||
| using (var command = Connection.CreateCommand()) | ||
| { | ||
| command.CommandText = string.Format("CREATE INDEX {0} ON {1} ({2})", quotedIndexName, quotedObjectName, _quoter.QuoteColumnName(column)); |
OracleManagedProcessor requires IOracleGenerator in its constructor, but RegisterOracleManagedGenerator only registered IOracleManagedGenerator. Add a TryAddScoped mapping from IOracleGenerator to IOracleManagedGenerator so DI can resolve it. This fixes 38 failing integration tests on Linux CI where the Oracle container is enabled.
|
@copilot Rebase this to main branch - we fixed the build errors that were blocking this PR from being accepted. We've since enabled Package Validation, so there might be errors relating to that step you may want to verify before pushing your final changes. |
…upport-and-update
Rebased in 838b061 (merged latest |
|
@copilot resolve the merge conflicts in this pull request |
…upport-and-update # Conflicts: # src/FluentMigrator.Runner/FluentMigrationRunnerBuilderExtensions.cs # test/FluentMigrator.Tests/FluentMigrator.Tests.csproj # test/FluentMigrator.Tests/Unit/Runners/DatabaseIdentifierTests.cs
Resolved in ee72e92. Conflicts were between this PR's Hana changes and upstream's Jet provider removal — |
Summary - Code CoverageSummary
CoverageFluentMigrator - 82.5%
FluentMigrator.Abstractions - 87.3%
FluentMigrator.Extensions.MySql - 55.5%
FluentMigrator.Extensions.Oracle - 79.1%
FluentMigrator.Extensions.Postgres - 72.3%
FluentMigrator.Extensions.Snowflake - 14.2%
FluentMigrator.Extensions.SqlServer - 84.8%
FluentMigrator.Runner - 0%
FluentMigrator.Runner.Core - 76.8%
FluentMigrator.Runner.Db2 - 62.8%
FluentMigrator.Runner.Firebird - 28.6%
FluentMigrator.Runner.Hana - 49.2%
FluentMigrator.Runner.MySql - 93.5%
FluentMigrator.Runner.Oracle - 81.1%
FluentMigrator.Runner.Postgres - 91.9%
FluentMigrator.Runner.Redshift - 73.6%
FluentMigrator.Runner.Snowflake - 67.2%
FluentMigrator.Runner.SQLite - 89.7%
FluentMigrator.Runner.SqlServer - 88.1%
Migrate - 61.9%
|
Replaces the bundled
lib/HanaDLL approach with modern NuGet package support. Removes the "Hana support will go away" deprecation notices now that the community has provided a viable path forward.Changes
lib/Hana/— all locally bundled SAP HANA DLLs and native libraries deleted from the repoAddHana8()(forSap.Data.Hana.Net.v8.0) andAddHana10()(forSap.Data.Hana.Net.v10.0); oldAddHana()marked[Obsolete]HanaDbFactory— added reflection lookup entries forSap.Data.Hana.v8.0andSap.Data.Hana.v10.0assemblies alongside the existing legacy entries for backward compatibility[Obsolete]from all Hana types —HanaProcessor,HanaGenerator,HanaQuoter,HanaTypeMap,HanaDescriptionGenerator,IHanaTypeMap,ProcessorIdConstants.Hana,GeneratorIdConstants.HanaAddAllDatabases()— platform-specific driver cannot be bundled in the catch-all methodFluentMigrator.Console.csprojandFluentMigrator.Tests.csprojHanaTestTable,HanaTestSequence) updated to useIDbConnection/IDbTransaction/IDbCommandinterfaces instead of concreteSap.Data.HanatypesUsage
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
l78vsblobprodsu6weus64.blob.core.windows.net/usr/bin/dotnet dotnet build FluentMigrator.sln --no-incremental(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/fluentmigrator/fluentmigrator/FluentMigrator.sln --packages /tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/fluentmigrator/fluentmigrator/src/FluentMigrator.MSBuild/FluentMigrator.MSBuild.csproj --packages /tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)pyvvsblobprodsu6weus63.blob.core.windows.net/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/fluentmigrator/fluentmigrator/FluentMigrator.sln --packages /tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/fluentmigrator/fluentmigrator/samples/FluentMigrator.Example.MSBuild/FluentMigrator.Example.MSBuild.csproj --packages /tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-ebbaa93091d3517f/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)www.nuget.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either: