mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 16:02:56 +08:00
Merge pull request #1390 from peppy/fix-ef-deletion
Fix issues with deletion
This commit is contained in:
commit
310df17e2d
@ -66,6 +66,7 @@ namespace osu.Game.Beatmaps
|
|||||||
if (beatmapSet.DeletePending) return false;
|
if (beatmapSet.DeletePending) return false;
|
||||||
|
|
||||||
beatmapSet.DeletePending = true;
|
beatmapSet.DeletePending = true;
|
||||||
|
context.Update(beatmapSet);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
BeatmapSetRemoved?.Invoke(beatmapSet);
|
BeatmapSetRemoved?.Invoke(beatmapSet);
|
||||||
@ -84,6 +85,7 @@ namespace osu.Game.Beatmaps
|
|||||||
if (!beatmapSet.DeletePending) return false;
|
if (!beatmapSet.DeletePending) return false;
|
||||||
|
|
||||||
beatmapSet.DeletePending = false;
|
beatmapSet.DeletePending = false;
|
||||||
|
context.Update(beatmapSet);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
BeatmapSetAdded?.Invoke(beatmapSet);
|
BeatmapSetAdded?.Invoke(beatmapSet);
|
||||||
@ -137,7 +139,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
// metadata is M-N so we can't rely on cascades
|
// metadata is M-N so we can't rely on cascades
|
||||||
context.BeatmapMetadata.RemoveRange(purgeable.Select(s => s.Metadata));
|
context.BeatmapMetadata.RemoveRange(purgeable.Select(s => s.Metadata));
|
||||||
context.BeatmapMetadata.RemoveRange(purgeable.SelectMany(s => s.Beatmaps.Select(b => b.Metadata)));
|
context.BeatmapMetadata.RemoveRange(purgeable.SelectMany(s => s.Beatmaps.Select(b => b.Metadata).Where(m => m != null)));
|
||||||
|
|
||||||
// todo: we can probably make cascades work here with a FK in BeatmapDifficulty. just make to make it work correctly.
|
// todo: we can probably make cascades work here with a FK in BeatmapDifficulty. just make to make it work correctly.
|
||||||
context.BeatmapDifficulty.RemoveRange(purgeable.SelectMany(s => s.Beatmaps.Select(b => b.BaseDifficulty)));
|
context.BeatmapDifficulty.RemoveRange(purgeable.SelectMany(s => s.Beatmaps.Select(b => b.BaseDifficulty)));
|
||||||
|
Loading…
Reference in New Issue
Block a user