Update for build & deploy process
This commit is contained in:
@@ -67,4 +67,21 @@ namespace TestAPI01.Seed
|
||||
return Path.Combine(currentDir, filePath);
|
||||
}
|
||||
}
|
||||
|
||||
public class MigrationData
|
||||
{
|
||||
public static void EnsureMigration(IServiceProvider serviceProvider)
|
||||
{
|
||||
Console.WriteLine("Migrate database...");
|
||||
|
||||
using (var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetService<DataContext>();
|
||||
context.Database.Migrate();
|
||||
}
|
||||
|
||||
Console.WriteLine("Done.");
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user