Added code to set sequence numbers for legacy txs
This commit is contained in:
@@ -51,6 +51,14 @@ namespace Swarmops.Backend
|
||||
|
||||
SystemSettings.BackendHostname = Dns.GetHostName();
|
||||
|
||||
|
||||
// Other one-time initializations
|
||||
|
||||
FinancialTransactions.FixAllUnsequenced();
|
||||
|
||||
|
||||
// Begin main loop
|
||||
|
||||
UnixSignal[] killSignals = null;
|
||||
|
||||
if (!Debugger.IsAttached)
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Swarmops.Basic.Types.Financial;
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Database;
|
||||
|
||||
namespace Swarmops.Logic.Financial
|
||||
{
|
||||
|
||||
@@ -70,5 +70,18 @@ namespace Swarmops.Logic.Financial
|
||||
|
||||
throw new NotImplementedException ("Unimplemented dependency type:" + foreignObject.GetType());
|
||||
}
|
||||
|
||||
// This needs only be run once. It populates the OrganizationSequenceId field.
|
||||
|
||||
public static void FixAllUnsequenced()
|
||||
{
|
||||
SwarmDb db = SwarmDb.GetDatabaseForReading();
|
||||
FinancialTransactions txs = FromArray(db.GetAllFinancialTransactionsWithoutSequenceNumber());
|
||||
|
||||
foreach (FinancialTransaction tx in txs)
|
||||
{
|
||||
tx.SetOrganizationSequenceId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user