Removed manual Migrate Series Relations migration from v0.7 release (5 releases ago). (#2158)

Don't try to backup the DB if it doesn't exist. This will stop errors in log on first start.
This commit is contained in:
Joe Milazzo 2023-07-25 08:16:28 -05:00 committed by GitHub
parent 1fbb9d0f52
commit c343764913
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 177 deletions

View file

@ -70,7 +70,8 @@ public class Program
var logger = services.GetRequiredService<ILogger<Program>>();
var context = services.GetRequiredService<DataContext>();
var pendingMigrations = await context.Database.GetPendingMigrationsAsync();
if (pendingMigrations.Any())
var isDbCreated = await context.Database.CanConnectAsync();
if (isDbCreated && pendingMigrations.Any())
{
logger.LogInformation("Performing backup as migrations are needed. Backup will be kavita.db in temp folder");
var migrationDirectory = await GetMigrationDirectory(context, directoryService);
@ -84,16 +85,6 @@ public class Program
}
}
// This must run before the migration
try
{
await MigrateSeriesRelationsExport.Migrate(context, logger);
}
catch (Exception)
{
// If fresh install, could fail and we should just carry on as it's not applicable
}
await context.Database.MigrateAsync();
await Seed.SeedRoles(services.GetRequiredService<RoleManager<AppRole>>());