Change the way migrations are checked for

This method allows switching between sqlite-net and EF builds without completely breaking. Note that DB migration still only happens in a forward direction, but this will allow switching back and forth without eventually being unable to start the game.
This commit is contained in:
Dean Herbert 2017-10-22 15:27:16 +09:00
parent 7302e5a236
commit 6818ebdaff

View File

@ -180,13 +180,15 @@ namespace osu.Game.Database
{
try
{
// will fail if EF hasn't touched the database yet.
Database.ExecuteSqlCommand("SELECT * FROM __EFMigrationsHistory LIMIT 1");
// will fail if the database isn't in a sane EF-migradted state.
Database.ExecuteSqlCommand("SELECT MetadataID FROM BeatmapSetInfo LIMIT 1");
}
catch
{
try
{
Database.ExecuteSqlCommand("DROP TABLE IF EXISTS __EFMigrationsHistory");
// will fail (intentionally) if we don't have sqlite-net data present.
Database.ExecuteSqlCommand("SELECT OnlineBeatmapSetId FROM BeatmapMetadata LIMIT 1");