Reformat and cleanup
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user