Reformat and cleanup

This commit is contained in:
kurt-mcrae
2025-05-04 20:11:57 +10:00
parent e054331b7f
commit 4a8bd9307b
4 changed files with 18 additions and 14 deletions
+12 -5
View File
@@ -4,13 +4,20 @@ using ServiceStack.OrmLite;
namespace backend.Database.Migrations;
[Description("Update MyTable")]
class Migration1001 : MigrationBase
internal class Migration1001 : MigrationBase
{
class Station
public override void Up()
{
Db.Migrate<Station>();
}
public override void Down()
{
Db.Revert<Station>();
}
private class Station
{
[Index] public DateTimeOffset? DeletedAt { get; set; }
}
public override void Up() => Db.Migrate<Station>();
public override void Down() => Db.Revert<Station>();
}
+1 -1
View File
@@ -9,8 +9,8 @@ namespace backend.Services.Init;
public class DatabaseInitialiser
{
private readonly IDbConnectionFactory _dbFactory;
private readonly MigrationService _migrationService;
private readonly ILogger<DatabaseInitialiser> _logger;
private readonly MigrationService _migrationService;
public DatabaseInitialiser(IDbConnectionFactory dbFactory, ILogger<DatabaseInitialiser> logger,
MigrationService migrationService)
+1 -4
View File
@@ -75,10 +75,7 @@ public class NswFuelApiService : INswFuelApiService
//stations which exist in the DB, but not in the reference data (they have been closed or updated)
var removedStations =
existingStations.Where(es => mappedStationData.All(ms => ms.Code != es.Code)).ToList();
foreach (var rs in removedStations)
{
rs.DeletedAt = DateTimeOffset.UtcNow;
}
foreach (var rs in removedStations) rs.DeletedAt = DateTimeOffset.UtcNow;
await db.UpdateAllAsync(removedStations);
+4 -4
View File
@@ -9,10 +9,10 @@
<ItemGroup>
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.18"/>
<PackageReference Include="Hangfire.PostgreSql" Version="1.20.12" />
<PackageReference Include="ServiceStack.OrmLite.PostgreSQL" Version="8.7.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="8.1.1" />
<PackageReference Include="Hangfire.PostgreSql" Version="1.20.12"/>
<PackageReference Include="ServiceStack.OrmLite.PostgreSQL" Version="8.7.2"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.1"/>
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="8.1.1"/>
</ItemGroup>
</Project>