Added migration tool
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
namespace HaDbMigration.Configuration;
|
||||
|
||||
public sealed class MigrationOptions
|
||||
{
|
||||
public required string SqlitePath { get; init; }
|
||||
public required string PostgresConnectionString { get; init; }
|
||||
public int BatchSize { get; init; } = 10_000;
|
||||
public bool Truncate { get; init; }
|
||||
public bool DryRun { get; init; }
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if (!File.Exists(SqlitePath))
|
||||
{
|
||||
throw new FileNotFoundException(
|
||||
$"SQLite database file not found: {SqlitePath}");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(PostgresConnectionString))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"PostgreSQL connection string is required.", nameof(PostgresConnectionString));
|
||||
}
|
||||
|
||||
if (BatchSize < 100)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
nameof(BatchSize), "Batch size must be at least 100.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user