refactor: address code review findings across all projects
Apply comprehensive fixes from code reviews including: - Extract shared utilities (SqlFormatHelper, CellValueConverter, DbDestinationBase) - Add interface abstractions (IAuthenticationService, IDatabaseMigrator, IMisQueryBuilder) - Implement SecureStore for encrypted secrets storage - Fix error handling with proper HTTP status codes and logging - Optimize double enumeration in DevEtlRegistry - Add DataSync.Dev README for developer onboarding - Extract filter panel base classes to reduce duplication - Update code review docs to mark all issues as fixed
This commit is contained in:
@@ -4,16 +4,25 @@ using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace JdeScoping.Database;
|
||||
|
||||
public class DatabaseMigrator
|
||||
/// <summary>
|
||||
/// Handles database migrations using DbUp.
|
||||
/// </summary>
|
||||
public class DatabaseMigrator : IDatabaseMigrator
|
||||
{
|
||||
private readonly string _connectionString;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DatabaseMigrator class.
|
||||
/// </summary>
|
||||
/// <param name="configuration">Application configuration containing connection strings.</param>
|
||||
/// <exception cref="InvalidOperationException">Thrown when SqlServer connection string is not configured.</exception>
|
||||
public DatabaseMigrator(IConfiguration configuration)
|
||||
{
|
||||
_connectionString = configuration.GetConnectionString("SqlServer")
|
||||
?? throw new InvalidOperationException("SqlServer connection string not configured");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public DatabaseUpgradeResult Migrate()
|
||||
{
|
||||
EnsureDatabase.For.SqlDatabase(_connectionString);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using DbUp.Engine;
|
||||
|
||||
namespace JdeScoping.Database;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for database migration operations.
|
||||
/// </summary>
|
||||
public interface IDatabaseMigrator
|
||||
{
|
||||
/// <summary>
|
||||
/// Runs all pending database migrations.
|
||||
/// </summary>
|
||||
/// <returns>The result of the migration operation.</returns>
|
||||
DatabaseUpgradeResult Migrate();
|
||||
}
|
||||
Reference in New Issue
Block a user