Skip to content

Commit

Permalink
Update DbMigrationMiddleware.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
EngincanV committed May 14, 2024
1 parent e6008a8 commit 76651c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/CmsKitDemo/Data/DbMigrationMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
var connString = await _connectionStringResolver.ResolveAsync();
var dbFilePath = connString.Replace("Data Source=", "").Replace(";Cache=Shared", "");
if (ShouldCreateUserDb(context, dbFilePath))

if (ShouldCreateUserDb(context, dbFilePath) || !context.Request.Cookies.ContainsKey("CMSKitDemoDbMigrated"))
{
await _dbMigrationService.MigrateAsync(connString);
context.Response.Cookies.Append("CMSKitDemoDbMigrated", "true");
}

await next(context);
Expand Down

0 comments on commit 76651c4

Please sign in to comment.