Added migration tool

This commit is contained in:
Marius
2026-03-12 09:47:49 +02:00
parent 27648ae57c
commit b262d10ea4
35 changed files with 2579 additions and 2 deletions
@@ -0,0 +1,6 @@
namespace HaDbMigration.Services.Interfaces;
public interface IMigrationOrchestrator
{
Task RunAsync(CancellationToken cancellationToken);
}
@@ -0,0 +1,14 @@
using System.Threading.Channels;
using HaDbMigration.Models;
namespace HaDbMigration.Services.Interfaces;
public interface IPostgresWriterService
{
Task WriteTableAsync(
TableDescriptor table,
ChannelReader<IReadOnlyList<object?[]>> reader,
CancellationToken cancellationToken);
Task<long> GetRowCountAsync(string tableName, CancellationToken cancellationToken);
}
@@ -0,0 +1,18 @@
using HaDbMigration.Models;
namespace HaDbMigration.Services.Interfaces;
public interface ISchemaService
{
Task<bool> ValidateTablesExistAsync(
IReadOnlyList<TableDescriptor> tables,
CancellationToken cancellationToken);
Task TruncateTablesAsync(
IReadOnlyList<TableDescriptor> tables,
CancellationToken cancellationToken);
Task ResetSequencesAsync(
IReadOnlyList<TableDescriptor> tables,
CancellationToken cancellationToken);
}
@@ -0,0 +1,14 @@
using System.Threading.Channels;
using HaDbMigration.Models;
namespace HaDbMigration.Services.Interfaces;
public interface ISqliteReaderService
{
Task ReadTableAsync(
TableDescriptor table,
ChannelWriter<IReadOnlyList<object?[]>> writer,
CancellationToken cancellationToken);
Task<long> GetRowCountAsync(string tableName, CancellationToken cancellationToken);
}
@@ -0,0 +1,16 @@
using HaDbMigration.Models;
namespace HaDbMigration.Services.Interfaces;
public sealed record TableValidationResult(
string TableName,
long SourceRowCount,
long TargetRowCount,
bool IsMatch);
public interface IValidationService
{
Task<IReadOnlyList<TableValidationResult>> ValidateRowCountsAsync(
IReadOnlyList<TableDescriptor> tables,
CancellationToken cancellationToken);
}