Skip to content

Commit

Permalink
Fix NRE if database was not deployed (#1737)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryvanderVegte authored Nov 10, 2022
1 parent 86f7da4 commit 191a47c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace FetchTranscription.Database
{
using Connector.Database;

using FetchTranscriptionFunction;

using Microsoft.Azure.WebJobs.Description;
using Microsoft.Azure.WebJobs.Host.Config;
using Microsoft.EntityFrameworkCore;
Expand All @@ -30,9 +32,12 @@ public DatabaseConfigProvider(IServiceScopeFactory scopeFactory)

public void Initialize(ExtensionConfigContext context)
{
using var scope = this.scopeFactory.CreateScope();
var databaseContext = scope.ServiceProvider.GetService<IngestionClientDbContext>();
databaseContext.Database.Migrate();
if (FetchTranscriptionEnvironmentVariables.UseSqlDatabase)
{
using var scope = this.scopeFactory.CreateScope();
var databaseContext = scope.ServiceProvider.GetService<IngestionClientDbContext>();
databaseContext.Database.Migrate();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
}
},
"variables": {
"Version": "v2.0.1",
"Version": "v2.0.2",
"AudioInputContainer": "audio-input",
"AudioProcessedContainer": "audio-processed",
"ErrorFilesOutputContainer": "audio-failed",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
}
},
"variables": {
"Version": "v2.0.1",
"Version": "v2.0.2",
"AudioInputContainer": "audio-input",
"AudioProcessedContainer": "audio-processed",
"ErrorFilesOutputContainer": "audio-failed",
Expand Down

0 comments on commit 191a47c

Please sign in to comment.