Added migration tool
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user