diff --git a/Cocotte/Program.cs b/Cocotte/Program.cs index c33fd66..f8bedf7 100644 --- a/Cocotte/Program.cs +++ b/Cocotte/Program.cs @@ -93,6 +93,12 @@ await using(var scope = host.Services.CreateAsyncScope()) } else { + // Backup database before migrations + if (File.Exists("cocotte.db")) + { + File.Copy("cocotte.db", $"cocotte.{DateTime.UtcNow:s}.db"); + } + // Apply migrations await dbContext.Database.MigrateAsync(); }