From 6818ebdaffd09c696c904506c09e0e29e4a136a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Oct 2017 15:27:16 +0900 Subject: [PATCH 1/2] 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. --- osu.Game/Database/OsuDbContext.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/OsuDbContext.cs b/osu.Game/Database/OsuDbContext.cs index 20d36f3ebe..d68c612bd5 100644 --- a/osu.Game/Database/OsuDbContext.cs +++ b/osu.Game/Database/OsuDbContext.cs @@ -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"); From 39b356880e22515bdf9b071922c6b10cf5510719 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Oct 2017 15:32:47 +0900 Subject: [PATCH 2/2] Fix typo --- osu.Game/Database/OsuDbContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/OsuDbContext.cs b/osu.Game/Database/OsuDbContext.cs index d68c612bd5..c509093cf9 100644 --- a/osu.Game/Database/OsuDbContext.cs +++ b/osu.Game/Database/OsuDbContext.cs @@ -180,7 +180,7 @@ namespace osu.Game.Database { try { - // will fail if the database isn't in a sane EF-migradted state. + // will fail if the database isn't in a sane EF-migrated state. Database.ExecuteSqlCommand("SELECT MetadataID FROM BeatmapSetInfo LIMIT 1"); } catch