Reset the beatmap database when it can't be read, rather than hard failing.

This commit is contained in:
Dean Herbert
2017-01-23 13:02:03 +09:00
parent 2025e8ef71
commit ef8347fe53

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
@ -35,11 +36,22 @@ namespace osu.Game.Database
if (connection == null) if (connection == null)
{ {
connection = storage.GetDatabase(@"beatmaps"); retry:
connection.CreateTable<BeatmapMetadata>(); try
connection.CreateTable<BaseDifficulty>(); {
connection.CreateTable<BeatmapSetInfo>(); connection = storage.GetDatabase(@"beatmaps");
connection.CreateTable<BeatmapInfo>(); connection.CreateTable<BeatmapMetadata>();
connection.CreateTable<BaseDifficulty>();
connection.CreateTable<BeatmapSetInfo>();
connection.CreateTable<BeatmapInfo>();
}
catch
{
Debug.WriteLine(@"Beatmap database was unable to be migrated; starting fresh!");
connection?.Close();
storage.DeleteDatabase(@"beatmaps");
goto retry;
}
} }
} }