mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:03:22 +08:00
Merge pull request #4013 from smoogipoo/beatmap-scores-foreignkey
Add explicit beatmap -> scores deletions rather than relying on FK cascades
This commit is contained in:
commit
e4ff36a5bc
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -9,6 +10,7 @@ using Newtonsoft.Json;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.IO.Serialization;
|
using osu.Game.IO.Serialization;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
@ -112,6 +114,11 @@ namespace osu.Game.Beatmaps
|
|||||||
[JsonProperty("difficulty_rating")]
|
[JsonProperty("difficulty_rating")]
|
||||||
public double StarDifficulty { get; set; }
|
public double StarDifficulty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Currently only populated for beatmap deletion. Use <see cref="ScoreManager"/> to query scores.
|
||||||
|
/// </summary>
|
||||||
|
public List<ScoreInfo> Scores { get; set; }
|
||||||
|
|
||||||
public override string ToString() => $"{Metadata} [{Version}]";
|
public override string ToString() => $"{Metadata} [{Version}]";
|
||||||
|
|
||||||
public bool Equals(BeatmapInfo other)
|
public bool Equals(BeatmapInfo other)
|
||||||
|
@ -64,7 +64,8 @@ namespace osu.Game.Beatmaps
|
|||||||
base.AddIncludesForDeletion(query)
|
base.AddIncludesForDeletion(query)
|
||||||
.Include(s => s.Beatmaps).ThenInclude(b => b.Metadata)
|
.Include(s => s.Beatmaps).ThenInclude(b => b.Metadata)
|
||||||
.Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty)
|
.Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty)
|
||||||
.Include(s => s.Metadata);
|
.Include(s => s.Metadata)
|
||||||
|
.Include(s => s.Beatmaps).ThenInclude(b => b.Scores);
|
||||||
|
|
||||||
protected override IQueryable<BeatmapSetInfo> AddIncludesForConsumption(IQueryable<BeatmapSetInfo> query) =>
|
protected override IQueryable<BeatmapSetInfo> AddIncludesForConsumption(IQueryable<BeatmapSetInfo> query) =>
|
||||||
base.AddIncludesForConsumption(query)
|
base.AddIncludesForConsumption(query)
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "2.1.4-rtm-31024");
|
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687");
|
||||||
|
|
||||||
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
|
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
|
||||||
{
|
{
|
||||||
@ -215,6 +215,25 @@ namespace osu.Game.Migrations
|
|||||||
b.ToTable("Settings");
|
b.ToTable("Settings");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ID")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Hash");
|
||||||
|
|
||||||
|
b.Property<int>("ReferenceCount");
|
||||||
|
|
||||||
|
b.HasKey("ID");
|
||||||
|
|
||||||
|
b.HasIndex("Hash")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("ReferenceCount");
|
||||||
|
|
||||||
|
b.ToTable("FileInfo");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
|
modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("ID")
|
b.Property<int>("ID")
|
||||||
@ -239,25 +258,6 @@ namespace osu.Game.Migrations
|
|||||||
b.ToTable("KeyBinding");
|
b.ToTable("KeyBinding");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<string>("Hash");
|
|
||||||
|
|
||||||
b.Property<int>("ReferenceCount");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("Hash")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("ReferenceCount");
|
|
||||||
|
|
||||||
b.ToTable("FileInfo");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
|
modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
|
||||||
{
|
{
|
||||||
b.Property<int?>("ID")
|
b.Property<int?>("ID")
|
||||||
@ -454,7 +454,7 @@ namespace osu.Game.Migrations
|
|||||||
modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b =>
|
modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap")
|
b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap")
|
||||||
.WithMany()
|
.WithMany("Scores")
|
||||||
.HasForeignKey("BeatmapInfoID")
|
.HasForeignKey("BeatmapInfoID")
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user