fix: avoid disposed mariadb connection during startup
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||||
using JobTrackerApi.Data;
|
using JobTrackerApi.Data;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
|
using MySqlConnector;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
@@ -673,10 +674,14 @@ CREATE TABLE IF NOT EXISTS "GmailConnections" (
|
|||||||
}
|
}
|
||||||
else
|
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();
|
conn.Open();
|
||||||
EnsureIdentityTablesMySql(conn);
|
EnsureIdentityTablesMySql(conn);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
db.Database.Migrate();
|
db.Database.Migrate();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user