mirror of
https://github.com/MAKS-IT-COM/maksit-certs-ui.git
synced 2026-05-16 04:48:12 +02:00
(bugfix): version_info table fix
This commit is contained in:
parent
4fc9cfdcea
commit
d7721ff80e
@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [3.3.20] - 2026-04-26
|
||||
|
||||
### Fixed
|
||||
|
||||
- **FluentMigrator DI:** **`AddFluentMigratorCore`** registers a default **`IVersionTableMetaDataAccessor`**; **`WithVersionTable`** on **`ConfigureRunner`** could still leave **`VersionInfo`** in use. Engine registration now removes any prior **`IVersionTableMetaDataAccessor`** descriptors and registers **`PassThroughVersionTableMetaDataAccessor`** for **`CertsFluentMigratorVersionTableMetaData`** so **`MigrateUp`** always targets **`version_info`**.
|
||||
|
||||
## [3.3.19] - 2026-04-26
|
||||
|
||||
### Changed
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using FluentMigrator.Runner;
|
||||
using FluentMigrator.Runner.Initialization;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using MaksIT.CertsUI.Engine.DomainServices;
|
||||
using MaksIT.CertsUI.Engine.FluentMigrations;
|
||||
@ -25,15 +26,21 @@ public static class ServiceCollectionExtensions {
|
||||
if (string.IsNullOrWhiteSpace(certsEngineConfiguration.ConnectionString))
|
||||
throw new ArgumentException("Certs engine connection string is required for FluentMigrator (empty string uses connectionless/preview mode and will not create tables).", nameof(certsEngineConfiguration));
|
||||
|
||||
// FluentMigrator: IRunMigrationsService invoked from Program.cs before RunAsync. Use .For.All() so version metadata
|
||||
// and migration discovery match in-process runner expectations (see FluentMigrator docs / #1062).
|
||||
// FluentMigrator: IRunMigrationsService invoked from Program.cs before RunAsync. Use .For.All() so migration discovery
|
||||
// matches in-process runner expectations (see FluentMigrator docs / #1062).
|
||||
// Version table: AddFluentMigratorCore registers a default IVersionTableMetaDataAccessor; replace it so public.version_info
|
||||
// is always used (ConfigureRunner's WithVersionTable alone can lose to that default depending on DI resolution order).
|
||||
services.AddFluentMigratorCore()
|
||||
.ConfigureRunner(rb => rb
|
||||
.AddPostgres()
|
||||
.WithGlobalConnectionString(certsEngineConfiguration.ConnectionString)
|
||||
.WithVersionTable(new CertsFluentMigratorVersionTableMetaData())
|
||||
.ScanIn(typeof(BaselineCertsSchema).Assembly).For.All())
|
||||
.AddLogging(lb => lb.AddFluentMigratorConsole());
|
||||
|
||||
foreach (var d in services.Where(x => x.ServiceType == typeof(IVersionTableMetaDataAccessor)).ToList())
|
||||
services.Remove(d);
|
||||
services.AddSingleton<IVersionTableMetaDataAccessor>(
|
||||
new PassThroughVersionTableMetaDataAccessor(new CertsFluentMigratorVersionTableMetaData()));
|
||||
services.AddScoped<IRunMigrationsService, RunMigrationsService>();
|
||||
services.AddScoped<ISchemaSyncService, SchemaSyncService>();
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>3.3.19</Version>
|
||||
<Version>3.3.20</Version>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user