fix: avoid disposed mariadb connection during startup
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using JobTrackerApi.Data;
|
||||
using System.Data.Common;
|
||||
using MySqlConnector;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
@@ -673,10 +674,14 @@ CREATE TABLE IF NOT EXISTS "GmailConnections" (
|
||||
}
|
||||
else
|
||||
{
|
||||
using DbConnection conn = db.Database.GetDbConnection();
|
||||
var cs = app.Configuration.GetConnectionString("JobTracker");
|
||||
if (!string.IsNullOrWhiteSpace(cs))
|
||||
{
|
||||
using var conn = new MySqlConnection(cs);
|
||||
conn.Open();
|
||||
EnsureIdentityTablesMySql(conn);
|
||||
}
|
||||
}
|
||||
|
||||
db.Database.Migrate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user