mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Fix: Impossible to create invoice after migration from Sqlite (Close #4743)
This commit is contained in:
@@ -242,6 +242,12 @@ namespace BTCPayServer.Hosting
|
||||
settings.FileSystemStorageAsDefault = true;
|
||||
await _Settings.UpdateSetting(settings);
|
||||
}
|
||||
if (!settings.FixSeqAfterSqliteMigration)
|
||||
{
|
||||
await FixSeqAfterSqliteMigration();
|
||||
settings.FixSeqAfterSqliteMigration = true;
|
||||
await _Settings.UpdateSetting(settings);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -250,6 +256,17 @@ namespace BTCPayServer.Hosting
|
||||
}
|
||||
}
|
||||
|
||||
private async Task FixSeqAfterSqliteMigration()
|
||||
{
|
||||
await using var ctx = _DBContextFactory.CreateContext();
|
||||
if (!ctx.Database.IsNpgsql())
|
||||
return;
|
||||
var state = await ToPostgresMigrationStartupTask.GetMigrationState(ctx);
|
||||
if (state != "complete")
|
||||
return;
|
||||
await ToPostgresMigrationStartupTask.UpdateSequenceInvoiceSearch(ctx);
|
||||
}
|
||||
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
|
||||
static WalletBlobInfo GetBlobInfo(WalletData walletData)
|
||||
|
||||
Reference in New Issue
Block a user