mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 19:21:14 +00:00
534ab41b8e
Pure whitespace-only cleanup uncovered by the new format gate from the previous commit. Verified via `git diff -w --stat`: only 4 files differ when whitespace is ignored, and those differ only by the BOM byte. Cleanup kinds applied across 22 source files: - BOM removal (MapConfig.cs, SatTile.cs, GeoUtils.cs, IntegrationTests/Program.cs) - CRLF -> LF (IntegrationTests/Program.cs) - Trailing whitespace on blank lines (Common, Api, DataAccess, IntegrationTests, Services.RegionProcessing, Services.TileDownloader) - Final newline added (RoutePoint.cs, GeoPoint.cs, others) After this commit `dotnet format whitespace SatelliteProvider.sln --verify-no-changes` exits 0; AC-1 is enforceable from `scripts/ run-tests.sh` going forward. Also lands the batch 22 report, code-review report (PASS_WITH_WARNINGS, 2 Low findings — both deferred per spec), dependency-table status update (AZ-372 -> Done (In Testing)), task archive (todo/ -> done/), and autodev state update. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System.Reflection;
|
|
using DbUp;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace SatelliteProvider.DataAccess;
|
|
|
|
public class DatabaseMigrator
|
|
{
|
|
private readonly string _connectionString;
|
|
private readonly ILogger<DatabaseMigrator>? _logger;
|
|
|
|
public DatabaseMigrator(string connectionString, ILogger<DatabaseMigrator>? logger = null)
|
|
{
|
|
_connectionString = connectionString;
|
|
_logger = logger;
|
|
}
|
|
|
|
public bool RunMigrations()
|
|
{
|
|
_logger?.LogInformation("Starting database migrations...");
|
|
|
|
EnsureDatabase.For.PostgresqlDatabase(_connectionString);
|
|
|
|
var upgrader = DeployChanges.To
|
|
.PostgresqlDatabase(_connectionString)
|
|
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly(),
|
|
script => script.Contains(".Migrations."))
|
|
.LogToConsole()
|
|
.Build();
|
|
|
|
var result = upgrader.PerformUpgrade();
|
|
|
|
if (!result.Successful)
|
|
{
|
|
_logger?.LogError(result.Error, "Database migration failed");
|
|
return false;
|
|
}
|
|
|
|
_logger?.LogInformation("Database migrations completed successfully");
|
|
return true;
|
|
}
|
|
}
|
|
|