Files
HomeAssistant/HaDbMigration/Configuration/MigrationOptions.cs
T
2026-03-12 09:47:49 +02:00

32 lines
934 B
C#

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.");
}
}
}