Skip to content

Commit

Permalink
disable migration service scope in program (temporary)
Browse files Browse the repository at this point in the history
  • Loading branch information
carvalholuigi25 committed Feb 20, 2024
1 parent b61fb8e commit 75ea244
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,24 @@

builder.Services.AddResponseCompression(opts =>
{
opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
new[] { "application/octet-stream" });
opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "application/octet-stream" });
});

var app = builder.Build();

var isMigServiceScopeEnabled = false;

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
using (var serviceScope = app.Services.CreateScope())
if(isMigServiceScopeEnabled)
{
var dbContext = serviceScope.ServiceProvider.GetRequiredService<DBContext>();
await dbContext.Database.MigrateAsync();
// or dbContext.Database.EnsureCreatedAsync();
using (var serviceScope = app.Services.CreateScope())
{
var dbContext = serviceScope.ServiceProvider.GetRequiredService<DBContext>();
await dbContext.Database.MigrateAsync();
// or dbContext.Database.EnsureCreatedAsync();
}
}

app.UseSwagger(options =>
Expand Down

0 comments on commit 75ea244

Please sign in to comment.