Changed migration history table to specific schema. Added log for applied migrations
This commit is contained in:
@@ -32,6 +32,7 @@ public class DataContext : DbContext
|
|||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder.MigrationsAssembly(typeof(DbContext).Assembly);
|
builder.MigrationsAssembly(typeof(DbContext).Assembly);
|
||||||
|
builder.MigrationsHistoryTable("__EFMigrationsHistory", "severs");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ public class DbMigrationService : IHostedLifecycleService
|
|||||||
await using var scope = ServiceProvider.CreateAsyncScope();
|
await using var scope = ServiceProvider.CreateAsyncScope();
|
||||||
var context = scope.ServiceProvider.GetRequiredService<DataContext>();
|
var context = scope.ServiceProvider.GetRequiredService<DataContext>();
|
||||||
|
|
||||||
|
var appliedMigrations = await context.Database.GetAppliedMigrationsAsync(cancellationToken);
|
||||||
|
Logger.LogTrace("Applied migrations: {names}", string.Join(", ", appliedMigrations));
|
||||||
|
|
||||||
var pendingMigrations = await context.Database.GetPendingMigrationsAsync(cancellationToken);
|
var pendingMigrations = await context.Database.GetPendingMigrationsAsync(cancellationToken);
|
||||||
var migrationNames = pendingMigrations.ToArray();
|
var migrationNames = pendingMigrations.ToArray();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user