aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Program.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-12 22:32:10 +0800
committercrupest <crupest@outlook.com>2021-02-12 22:32:10 +0800
commit5849d34d9fcf1ccfb7fe5cc0842765129f7198b4 (patch)
tree8a4af35bd8fb2ca553025388532ef43b67408560 /BackEnd/Timeline/Program.cs
parent118fb9b15ba62837a0befaad0aaea156b0488aea (diff)
downloadtimeline-5849d34d9fcf1ccfb7fe5cc0842765129f7198b4.tar.gz
timeline-5849d34d9fcf1ccfb7fe5cc0842765129f7198b4.tar.bz2
timeline-5849d34d9fcf1ccfb7fe5cc0842765129f7198b4.zip
fix: Fix migration bug.
Diffstat (limited to 'BackEnd/Timeline/Program.cs')
-rw-r--r--BackEnd/Timeline/Program.cs14
1 files changed, 7 insertions, 7 deletions
diff --git a/BackEnd/Timeline/Program.cs b/BackEnd/Timeline/Program.cs
index 0f75908f..19fa6e37 100644
--- a/BackEnd/Timeline/Program.cs
+++ b/BackEnd/Timeline/Program.cs
@@ -4,6 +4,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Resources;
+using System.Threading.Tasks;
using Timeline.Entities;
using Timeline.Services;
using Timeline.Services.Migration;
@@ -14,20 +15,19 @@ namespace Timeline
{
public static class Program
{
- public static void Main(string[] args)
+ public async static Task Main(string[] args)
{
var host = CreateWebHostBuilder(args).Build();
+ var databaseBackupService = host.Services.GetRequiredService<IDatabaseBackupService>();
+ databaseBackupService.BackupNow();
+
using (var scope = host.Services.CreateScope())
{
- var databaseBackupService = scope.ServiceProvider.GetRequiredService<IDatabaseBackupService>();
- databaseBackupService.BackupNow();
-
var databaseContext = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
- databaseContext.Database.Migrate();
-
+ await databaseContext.Database.MigrateAsync();
var customMigrationManager = scope.ServiceProvider.GetRequiredService<ICustomMigrationManager>();
- customMigrationManager.Migrate();
+ await customMigrationManager.Migrate();
}
host.Run();