Skip to content

Commit 76651c4

Browse files
committed
Update DbMigrationMiddleware.cs
1 parent e6008a8 commit 76651c4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/CmsKitDemo/Data/DbMigrationMiddleware.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)
1919
{
2020
var connString = await _connectionStringResolver.ResolveAsync();
2121
var dbFilePath = connString.Replace("Data Source=", "").Replace(";Cache=Shared", "");
22-
23-
if (ShouldCreateUserDb(context, dbFilePath))
22+
23+
if (ShouldCreateUserDb(context, dbFilePath) || !context.Request.Cookies.ContainsKey("CMSKitDemoDbMigrated"))
2424
{
2525
await _dbMigrationService.MigrateAsync(connString);
26+
context.Response.Cookies.Append("CMSKitDemoDbMigrated", "true");
2627
}
2728

2829
await next(context);

0 commit comments

Comments
 (0)