1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 18:53:21 +08:00

Let's not rename columns yet

This commit is contained in:
smoogipoo 2017-10-14 14:28:25 +09:00
parent 674ad4a30c
commit b178be21d1
51 changed files with 351 additions and 362 deletions

View File

@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original); Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original);
if (original.BeatmapInfo.RulesetInfoId == 3) if (original.BeatmapInfo.RulesetID == 3)
{ {
// Post processing step to transform mania hit objects with the same start time into strong hits // Post processing step to transform mania hit objects with the same start time into strong hits
converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x => converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x =>

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
{ {
var beatmap = decoder.Decode(new StreamReader(stream)); var beatmap = decoder.Decode(new StreamReader(stream));
var meta = beatmap.BeatmapInfo.Metadata; var meta = beatmap.BeatmapInfo.Metadata;
Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId); Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.Artist);
Assert.AreEqual("Soleily", meta.ArtistUnicode); Assert.AreEqual("Soleily", meta.ArtistUnicode);
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile); Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
@ -49,7 +49,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(false, beatmapInfo.Countdown); Assert.AreEqual(false, beatmapInfo.Countdown);
Assert.AreEqual(0.7f, beatmapInfo.StackLeniency); Assert.AreEqual(0.7f, beatmapInfo.StackLeniency);
Assert.AreEqual(false, beatmapInfo.SpecialStyle); Assert.AreEqual(false, beatmapInfo.SpecialStyle);
Assert.IsTrue(beatmapInfo.RulesetInfoId == 0); Assert.IsTrue(beatmapInfo.RulesetID == 0);
Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks); Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks);
Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard); Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard);
} }

View File

@ -111,14 +111,14 @@ namespace osu.Game.Tests.Beatmaps.IO
var store = osu.Dependencies.Get<BeatmapManager>(); var store = osu.Dependencies.Get<BeatmapManager>();
waitForOrAssert(() => (resultSets = store.QueryBeatmapSets(s => s.BeatmapSetOnlineInfoId == 241526)).Any(), waitForOrAssert(() => (resultSets = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526)).Any(),
@"BeatmapSet did not import to the database in allocated time.", timeout); @"BeatmapSet did not import to the database in allocated time.", timeout);
//ensure we were stored to beatmap database backing... //ensure we were stored to beatmap database backing...
Assert.IsTrue(resultSets.Count() == 1, $@"Incorrect result count found ({resultSets.Count()} but should be 1)."); Assert.IsTrue(resultSets.Count() == 1, $@"Incorrect result count found ({resultSets.Count()} but should be 1).");
Func<IEnumerable<BeatmapInfo>> queryBeatmaps = () => store.QueryBeatmaps(s => s.BeatmapSetOnlineInfoId == 241526 && s.BeatmapDifficultyId > 0); Func<IEnumerable<BeatmapInfo>> queryBeatmaps = () => store.QueryBeatmaps(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0);
Func<IEnumerable<BeatmapSetInfo>> queryBeatmapSets = () => store.QueryBeatmapSets(s => s.BeatmapSetOnlineInfoId == 241526); Func<IEnumerable<BeatmapSetInfo>> queryBeatmapSets = () => store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526);
//if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet.
waitForOrAssert(() => queryBeatmaps().Count() == 12, waitForOrAssert(() => queryBeatmaps().Count() == 12,
@ -141,16 +141,16 @@ namespace osu.Game.Tests.Beatmaps.IO
Assert.IsTrue(set.Beatmaps.Count > 0); Assert.IsTrue(set.Beatmaps.Count > 0);
var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 0))?.Beatmap; var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Count > 0); Assert.IsTrue(beatmap?.HitObjects.Count > 0);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 1))?.Beatmap; beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Count > 0); Assert.IsTrue(beatmap?.HitObjects.Count > 0);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 2))?.Beatmap; beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Count > 0); Assert.IsTrue(beatmap?.HitObjects.Count > 0);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 3))?.Beatmap; beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Count > 0); Assert.IsTrue(beatmap?.HitObjects.Count > 0);
} }

View File

@ -52,7 +52,7 @@ namespace osu.Game.Tests.Beatmaps.IO
using (var stream = new StreamReader(reader.GetStream("Soleily - Renatus (Deif) [Platter].osu"))) using (var stream = new StreamReader(reader.GetStream("Soleily - Renatus (Deif) [Platter].osu")))
meta = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; meta = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata;
Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId); Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.Artist);
Assert.AreEqual("Soleily", meta.ArtistUnicode); Assert.AreEqual("Soleily", meta.ArtistUnicode);
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile); Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);

View File

@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps
public const float DEFAULT_DIFFICULTY = 5; public const float DEFAULT_DIFFICULTY = 5;
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int ID { get; set; }
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY; public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY; public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;
public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY; public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY;

View File

@ -14,26 +14,26 @@ namespace osu.Game.Beatmaps
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int ID { get; set; }
//TODO: should be in database //TODO: should be in database
public int BeatmapVersion; public int BeatmapVersion;
[JsonProperty("id")] [JsonProperty("id")]
[NotMapped] [NotMapped]
public int? BeatmapOnlineInfoId { get; set; } public int? OnlineBeatmapID { get; set; }
[JsonProperty("beatmapset_id")] [JsonProperty("beatmapset_id")]
[NotMapped] [NotMapped]
public int? BeatmapSetOnlineInfoId { get; set; } public int? OnlineBeatmapSetID { get; set; }
public int BeatmapSetInfoId { get; set; } public int BeatmapSetInfoID { get; set; }
[Required] [Required]
public BeatmapSetInfo BeatmapSet { get; set; } public BeatmapSetInfo BeatmapSet { get; set; }
public BeatmapMetadata Metadata { get; set; } public BeatmapMetadata Metadata { get; set; }
public int BeatmapDifficultyId { get; set; } public int BaseDifficultyID { get; set; }
[Required] [Required]
public BeatmapDifficulty Difficulty { get; set; } public BeatmapDifficulty Difficulty { get; set; }
@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps
public float StackLeniency { get; set; } public float StackLeniency { get; set; }
public bool SpecialStyle { get; set; } public bool SpecialStyle { get; set; }
public int RulesetInfoId { get; set; } public int RulesetID { get; set; }
public RulesetInfo Ruleset { get; set; } public RulesetInfo Ruleset { get; set; }
@ -109,12 +109,12 @@ namespace osu.Game.Beatmaps
public bool Equals(BeatmapInfo other) public bool Equals(BeatmapInfo other)
{ {
if (Id == 0 || other?.Id == 0) if (ID == 0 || other?.ID == 0)
// one of the two BeatmapInfos we are comparing isn't sourced from a database. // one of the two BeatmapInfos we are comparing isn't sourced from a database.
// fall back to reference equality. // fall back to reference equality.
return ReferenceEquals(this, other); return ReferenceEquals(this, other);
return Id == other?.Id; return ID == other?.ID;
} }
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&

View File

@ -180,7 +180,7 @@ namespace osu.Game.Beatmaps
public void Import(BeatmapSetInfo beatmapSetInfo) public void Import(BeatmapSetInfo beatmapSetInfo)
{ {
// If we have an ID then we already exist in the database. // If we have an ID then we already exist in the database.
if (beatmapSetInfo.Id != 0) return; if (beatmapSetInfo.ID != 0) return;
beatmaps.Add(beatmapSetInfo); beatmaps.Add(beatmapSetInfo);
} }
@ -251,7 +251,7 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
/// <param name="beatmap">The <see cref="BeatmapSetInfo"/> whose download request is wanted.</param> /// <param name="beatmap">The <see cref="BeatmapSetInfo"/> whose download request is wanted.</param>
/// <returns>The <see cref="DownloadBeatmapSetRequest"/> object if it exists, or null.</returns> /// <returns>The <see cref="DownloadBeatmapSetRequest"/> object if it exists, or null.</returns>
public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.BeatmapSetOnlineInfoId == beatmap.BeatmapSetOnlineInfoId); public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID);
/// <summary> /// <summary>
/// Delete a beatmap from the manager. /// Delete a beatmap from the manager.
@ -303,7 +303,7 @@ namespace osu.Game.Beatmaps
return DefaultBeatmap; return DefaultBeatmap;
if (beatmapInfo.BeatmapSet == null) if (beatmapInfo.BeatmapSet == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoId} is not in the local database."); throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
if (beatmapInfo.Metadata == null) if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
@ -344,7 +344,7 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
/// <param name="beatmapSet">A stale instance.</param> /// <param name="beatmapSet">A stale instance.</param>
/// <returns>A fresh instance.</returns> /// <returns>A fresh instance.</returns>
public BeatmapSetInfo Refresh(BeatmapSetInfo beatmapSet) => QueryBeatmapSet(s => s.Id == beatmapSet.Id); public BeatmapSetInfo Refresh(BeatmapSetInfo beatmapSet) => QueryBeatmapSet(s => s.ID == beatmapSet.ID);
/// <summary> /// <summary>
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s. /// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
@ -449,7 +449,7 @@ namespace osu.Game.Beatmaps
beatmapSet = new BeatmapSetInfo beatmapSet = new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = metadata.BeatmapSetOnlineInfoId, OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
Beatmaps = new List<BeatmapInfo>(), Beatmaps = new List<BeatmapInfo>(),
Hash = hash, Hash = hash,
Files = fileInfos, Files = fileInfos,
@ -478,8 +478,8 @@ namespace osu.Game.Beatmaps
beatmap.BeatmapInfo.Metadata = null; beatmap.BeatmapInfo.Metadata = null;
// TODO: this should be done in a better place once we actually need to dynamically update it. // TODO: this should be done in a better place once we actually need to dynamically update it.
beatmap.BeatmapInfo.Ruleset = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId); beatmap.BeatmapInfo.Ruleset = rulesets.QueryRulesetInfo(r => r.ID == beatmap.BeatmapInfo.RulesetID);
beatmap.BeatmapInfo.StarDifficulty = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId)?.CreateInstance()?.CreateDifficultyCalculator(beatmap) beatmap.BeatmapInfo.StarDifficulty = rulesets.QueryRulesetInfo(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap)
.Calculate() ?? 0; .Calculate() ?? 0;
beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);

View File

@ -10,11 +10,10 @@ namespace osu.Game.Beatmaps
public class BeatmapMetadata public class BeatmapMetadata
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int ID { get; set; }
[NotMapped] [NotMapped]
public int? BeatmapSetOnlineInfoId { get; set; } public int? OnlineBeatmapSetID { get; set; }
public int BeatmapSetInfoId { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string TitleUnicode { get; set; } public string TitleUnicode { get; set; }

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace osu.Game.Beatmaps namespace osu.Game.Beatmaps
@ -11,9 +10,6 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
public class BeatmapOnlineInfo public class BeatmapOnlineInfo
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
/// <summary> /// <summary>
/// The length in milliseconds of this beatmap's song. /// The length in milliseconds of this beatmap's song.
/// </summary> /// </summary>

View File

@ -10,11 +10,11 @@ namespace osu.Game.Beatmaps
public class BeatmapSetFileInfo public class BeatmapSetFileInfo
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int ID { get; set; }
public int BeatmapSetInfoId { get; set; } public int BeatmapSetInfoID { get; set; }
public int FileInfoId { get; set; } public int FileInfoID { get; set; }
public FileInfo FileInfo { get; set; } public FileInfo FileInfo { get; set; }

View File

@ -10,10 +10,10 @@ namespace osu.Game.Beatmaps
public class BeatmapSetInfo public class BeatmapSetInfo
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int ID { get; set; }
[NotMapped] [NotMapped]
public int? BeatmapSetOnlineInfoId { get; set; } public int? OnlineBeatmapSetID { get; set; }
public BeatmapMetadata Metadata { get; set; } public BeatmapMetadata Metadata { get; set; }

View File

@ -2,9 +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 Newtonsoft.Json; using Newtonsoft.Json;
using osu.Game.Users; using osu.Game.Users;
@ -15,19 +13,11 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
public class BeatmapSetOnlineInfo public class BeatmapSetOnlineInfo
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
/// <summary> /// <summary>
/// The author of the beatmaps in this set. /// The author of the beatmaps in this set.
/// </summary> /// </summary>
public User Author; public User Author;
public int BeatmapSetInfoId { get; set; }
public BeatmapSetInfo BeatmapSetInfo { get; set; }
public List<BeatmapInfo> Beatmaps { get; set; }
/// <summary> /// <summary>
/// The date this beatmap set was submitted to the online listing. /// The date this beatmap set was submitted to the online listing.
/// </summary> /// </summary>
@ -75,9 +65,6 @@ namespace osu.Game.Beatmaps
public class BeatmapSetOnlineCovers public class BeatmapSetOnlineCovers
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string CoverLowRes { get; set; } public string CoverLowRes { get; set; }
[JsonProperty(@"cover@2x")] [JsonProperty(@"cover@2x")]

View File

@ -97,9 +97,9 @@ namespace osu.Game.Beatmaps.Formats
beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo); beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
break; break;
case @"Mode": case @"Mode":
beatmap.BeatmapInfo.RulesetInfoId = int.Parse(pair.Value); beatmap.BeatmapInfo.RulesetID = int.Parse(pair.Value);
switch (beatmap.BeatmapInfo.RulesetInfoId) switch (beatmap.BeatmapInfo.RulesetID)
{ {
case 0: case 0:
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(); parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser();
@ -183,11 +183,11 @@ namespace osu.Game.Beatmaps.Formats
beatmap.BeatmapInfo.Metadata.Tags = pair.Value; beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
break; break;
case @"BeatmapID": case @"BeatmapID":
beatmap.BeatmapInfo.BeatmapOnlineInfoId = int.Parse(pair.Value); beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(pair.Value);
break; break;
case @"BeatmapSetID": case @"BeatmapSetID":
beatmap.BeatmapInfo.BeatmapSetOnlineInfoId = int.Parse(pair.Value); beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(pair.Value);
metadata.BeatmapSetOnlineInfoId = int.Parse(pair.Value); metadata.OnlineBeatmapSetID = int.Parse(pair.Value);
break; break;
} }
} }

View File

@ -9,7 +9,7 @@ namespace osu.Game.IO
public class FileInfo public class FileInfo
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int ID { get; set; }
public string Hash { get; set; } public string Hash { get; set; }

View File

@ -85,9 +85,9 @@ namespace osu.Game.IO
public void Reference(params FileInfo[] files) public void Reference(params FileInfo[] files)
{ {
var incrementedFiles = files.GroupBy(f => f.Id).Select(f => var incrementedFiles = files.GroupBy(f => f.ID).Select(f =>
{ {
var accurateRefCount = Connection.Find<FileInfo>(f.First().Id); var accurateRefCount = Connection.Find<FileInfo>(f.First().ID);
accurateRefCount.ReferenceCount += f.Count(); accurateRefCount.ReferenceCount += f.Count();
return accurateRefCount; return accurateRefCount;
}); });
@ -96,9 +96,9 @@ namespace osu.Game.IO
public void Dereference(params FileInfo[] files) public void Dereference(params FileInfo[] files)
{ {
var incrementedFiles = files.GroupBy(f => f.Id).Select(f => var incrementedFiles = files.GroupBy(f => f.ID).Select(f =>
{ {
var accurateRefCount = Connection.Find<FileInfo>(f.First().Id); var accurateRefCount = Connection.Find<FileInfo>(f.First().ID);
accurateRefCount.ReferenceCount -= f.Count(); accurateRefCount.ReferenceCount -= f.Count();
return accurateRefCount; return accurateRefCount;
}); });

View File

@ -10,9 +10,9 @@ namespace osu.Game.Input.Bindings
public class DatabasedKeyBinding : KeyBinding public class DatabasedKeyBinding : KeyBinding
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } public int ID { get; set; }
public int? RulesetInfoId { get; set; } public int? RulesetID { get; set; }
public int? Variant { get; set; } public int? Variant { get; set; }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Input.Bindings
protected override void ReloadMappings() protected override void ReloadMappings()
{ {
KeyBindings = store.Query(ruleset?.Id, variant); KeyBindings = store.Query(ruleset?.ID, variant);
} }
} }
} }

View File

@ -22,7 +22,7 @@ namespace osu.Game.Input
{ {
var ruleset = info.CreateInstance(); var ruleset = info.CreateInstance();
foreach (var variant in ruleset.AvailableVariants) foreach (var variant in ruleset.AvailableVariants)
insertDefaults(ruleset.GetDefaultKeyBindings(variant), info.Id, variant); insertDefaults(ruleset.GetDefaultKeyBindings(variant), info.ID, variant);
} }
} }
@ -48,7 +48,7 @@ namespace osu.Game.Input
{ {
KeyCombination = insertable.KeyCombination, KeyCombination = insertable.KeyCombination,
Action = insertable.Action, Action = insertable.Action,
RulesetInfoId = rulesetId, RulesetID = rulesetId,
Variant = variant Variant = variant
}); });
Connection.SaveChanges(); Connection.SaveChanges();
@ -62,7 +62,7 @@ namespace osu.Game.Input
}; };
public List<KeyBinding> Query(int? rulesetId = null, int? variant = null) => public List<KeyBinding> Query(int? rulesetId = null, int? variant = null) =>
new List<KeyBinding>(Connection.DatabasedKeyBinding.Where(b => b.RulesetInfoId == rulesetId && b.Variant == variant)); new List<KeyBinding>(Connection.DatabasedKeyBinding.Where(b => b.RulesetID == rulesetId && b.Variant == variant));
public void Update(KeyBinding keyBinding) public void Update(KeyBinding keyBinding)
{ {

View File

@ -1,4 +1,7 @@
using Microsoft.EntityFrameworkCore.Migrations; // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Microsoft.EntityFrameworkCore.Migrations;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -12,7 +15,7 @@ namespace osu.Game.Migrations
name: "BeatmapDifficulty", name: "BeatmapDifficulty",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false) ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
ApproachRate = table.Column<float>(type: "REAL", nullable: false), ApproachRate = table.Column<float>(type: "REAL", nullable: false),
CircleSize = table.Column<float>(type: "REAL", nullable: false), CircleSize = table.Column<float>(type: "REAL", nullable: false),
@ -23,81 +26,20 @@ namespace osu.Game.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_BeatmapDifficulty", x => x.Id); table.PrimaryKey("PK_BeatmapDifficulty", x => x.ID);
});
migrationBuilder.CreateTable(
name: "BeatmapSetInfo",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DeletePending = table.Column<bool>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true),
Protected = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapSetInfo", x => x.Id);
});
migrationBuilder.CreateTable(
name: "FileInfo",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Hash = table.Column<string>(type: "TEXT", nullable: true),
ReferenceCount = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FileInfo", x => x.Id);
});
migrationBuilder.CreateTable(
name: "KeyBinding",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Action = table.Column<int>(type: "INTEGER", nullable: false),
Keys = table.Column<string>(type: "TEXT", nullable: true),
RulesetInfoId = table.Column<int>(type: "INTEGER", nullable: true),
Variant = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_KeyBinding", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RulesetInfo",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Available = table.Column<bool>(type: "INTEGER", nullable: false),
InstantiationInfo = table.Column<string>(type: "TEXT", nullable: true),
Name = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RulesetInfo", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapMetadata", name: "BeatmapMetadata",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false) ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Artist = table.Column<string>(type: "TEXT", nullable: true), Artist = table.Column<string>(type: "TEXT", nullable: true),
ArtistUnicode = table.Column<string>(type: "TEXT", nullable: true), ArtistUnicode = table.Column<string>(type: "TEXT", nullable: true),
AudioFile = table.Column<string>(type: "TEXT", nullable: true), AudioFile = table.Column<string>(type: "TEXT", nullable: true),
Author = table.Column<string>(type: "TEXT", nullable: true), Author = table.Column<string>(type: "TEXT", nullable: true),
BackgroundFile = table.Column<string>(type: "TEXT", nullable: true), BackgroundFile = table.Column<string>(type: "TEXT", nullable: true),
BeatmapSetInfoId = table.Column<int>(type: "INTEGER", nullable: false),
PreviewTime = table.Column<int>(type: "INTEGER", nullable: false), PreviewTime = table.Column<int>(type: "INTEGER", nullable: false),
Source = table.Column<string>(type: "TEXT", nullable: true), Source = table.Column<string>(type: "TEXT", nullable: true),
Tags = table.Column<string>(type: "TEXT", nullable: true), Tags = table.Column<string>(type: "TEXT", nullable: true),
@ -106,62 +48,97 @@ namespace osu.Game.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_BeatmapMetadata", x => x.Id); table.PrimaryKey("PK_BeatmapMetadata", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapMetadata_BeatmapSetInfo_BeatmapSetInfoId",
column: x => x.BeatmapSetInfoId,
principalTable: "BeatmapSetInfo",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapSetFileInfo", name: "FileInfo",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false) ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
BeatmapSetInfoId = table.Column<int>(type: "INTEGER", nullable: false), Hash = table.Column<string>(type: "TEXT", nullable: true),
FileInfoId = table.Column<int>(type: "INTEGER", nullable: false), ReferenceCount = table.Column<int>(type: "INTEGER", nullable: false)
Filename = table.Column<string>(type: "TEXT", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_BeatmapSetFileInfo", x => x.Id); table.PrimaryKey("PK_FileInfo", x => x.ID);
});
migrationBuilder.CreateTable(
name: "KeyBinding",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Action = table.Column<int>(type: "INTEGER", nullable: false),
Keys = table.Column<string>(type: "TEXT", nullable: true),
RulesetID = table.Column<int>(type: "INTEGER", nullable: true),
Variant = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_KeyBinding", x => x.ID);
});
migrationBuilder.CreateTable(
name: "RulesetInfo",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Available = table.Column<bool>(type: "INTEGER", nullable: false),
InstantiationInfo = table.Column<string>(type: "TEXT", nullable: true),
Name = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RulesetInfo", x => x.ID);
});
migrationBuilder.CreateTable(
name: "BeatmapSetInfo",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DeletePending = table.Column<bool>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true),
MetadataID = table.Column<int>(type: "INTEGER", nullable: true),
Protected = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID);
table.ForeignKey( table.ForeignKey(
name: "FK_BeatmapSetFileInfo_BeatmapSetInfo_BeatmapSetInfoId", name: "FK_BeatmapSetInfo_BeatmapMetadata_MetadataID",
column: x => x.BeatmapSetInfoId, column: x => x.MetadataID,
principalTable: "BeatmapSetInfo", principalTable: "BeatmapMetadata",
principalColumn: "Id", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BeatmapSetFileInfo_FileInfo_FileInfoId",
column: x => x.FileInfoId,
principalTable: "FileInfo",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapInfo", name: "BeatmapInfo",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false) ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
AudioLeadIn = table.Column<int>(type: "INTEGER", nullable: false), AudioLeadIn = table.Column<int>(type: "INTEGER", nullable: false),
BaseDifficultyID = table.Column<int>(type: "INTEGER", nullable: false),
BeatDivisor = table.Column<int>(type: "INTEGER", nullable: false), BeatDivisor = table.Column<int>(type: "INTEGER", nullable: false),
BeatmapDifficultyId = table.Column<int>(type: "INTEGER", nullable: false), BeatmapSetInfoID = table.Column<int>(type: "INTEGER", nullable: false),
BeatmapSetInfoId = table.Column<int>(type: "INTEGER", nullable: false),
Countdown = table.Column<bool>(type: "INTEGER", nullable: false), Countdown = table.Column<bool>(type: "INTEGER", nullable: false),
DifficultyID = table.Column<int>(type: "INTEGER", nullable: false),
DistanceSpacing = table.Column<double>(type: "REAL", nullable: false), DistanceSpacing = table.Column<double>(type: "REAL", nullable: false),
GridSize = table.Column<int>(type: "INTEGER", nullable: false), GridSize = table.Column<int>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true), Hash = table.Column<string>(type: "TEXT", nullable: true),
Hidden = table.Column<bool>(type: "INTEGER", nullable: false), Hidden = table.Column<bool>(type: "INTEGER", nullable: false),
LetterboxInBreaks = table.Column<bool>(type: "INTEGER", nullable: false), LetterboxInBreaks = table.Column<bool>(type: "INTEGER", nullable: false),
MD5Hash = table.Column<string>(type: "TEXT", nullable: true), MD5Hash = table.Column<string>(type: "TEXT", nullable: true),
MetadataId = table.Column<int>(type: "INTEGER", nullable: true), MetadataID = table.Column<int>(type: "INTEGER", nullable: true),
Path = table.Column<string>(type: "TEXT", nullable: true), Path = table.Column<string>(type: "TEXT", nullable: true),
RulesetInfoId = table.Column<int>(type: "INTEGER", nullable: false), RulesetID = table.Column<int>(type: "INTEGER", nullable: false),
SpecialStyle = table.Column<bool>(type: "INTEGER", nullable: false), SpecialStyle = table.Column<bool>(type: "INTEGER", nullable: false),
StackLeniency = table.Column<float>(type: "REAL", nullable: false), StackLeniency = table.Column<float>(type: "REAL", nullable: false),
StarDifficulty = table.Column<double>(type: "REAL", nullable: false), StarDifficulty = table.Column<double>(type: "REAL", nullable: false),
@ -172,42 +149,69 @@ namespace osu.Game.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_BeatmapInfo", x => x.Id); table.PrimaryKey("PK_BeatmapInfo", x => x.ID);
table.ForeignKey( table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapDifficulty_BeatmapDifficultyId", name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapDifficultyId, column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapDifficulty",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoId",
column: x => x.BeatmapSetInfoId,
principalTable: "BeatmapSetInfo", principalTable: "BeatmapSetInfo",
principalColumn: "Id", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapMetadata_MetadataId", name: "FK_BeatmapInfo_BeatmapDifficulty_DifficultyID",
column: x => x.MetadataId, column: x => x.DifficultyID,
principalTable: "BeatmapDifficulty",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapMetadata_MetadataID",
column: x => x.MetadataID,
principalTable: "BeatmapMetadata", principalTable: "BeatmapMetadata",
principalColumn: "Id", principalColumn: "ID",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
table.ForeignKey( table.ForeignKey(
name: "FK_BeatmapInfo_RulesetInfo_RulesetInfoId", name: "FK_BeatmapInfo_RulesetInfo_RulesetID",
column: x => x.RulesetInfoId, column: x => x.RulesetID,
principalTable: "RulesetInfo", principalTable: "RulesetInfo",
principalColumn: "Id", principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BeatmapSetFileInfo",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
BeatmapSetInfoID = table.Column<int>(type: "INTEGER", nullable: false),
FileInfoID = table.Column<int>(type: "INTEGER", nullable: false),
Filename = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapSetFileInfo", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapSetFileInfo_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapSetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapSetFileInfo_FileInfo_FileInfoID",
column: x => x.FileInfoID,
principalTable: "FileInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_BeatmapDifficultyId", name: "IX_BeatmapInfo_BeatmapSetInfoID",
table: "BeatmapInfo", table: "BeatmapInfo",
column: "BeatmapDifficultyId"); column: "BeatmapSetInfoID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_BeatmapSetInfoId", name: "IX_BeatmapInfo_DifficultyID",
table: "BeatmapInfo", table: "BeatmapInfo",
column: "BeatmapSetInfoId"); column: "DifficultyID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_MD5Hash", name: "IX_BeatmapInfo_MD5Hash",
@ -215,36 +219,35 @@ namespace osu.Game.Migrations
column: "MD5Hash"); column: "MD5Hash");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_MetadataId", name: "IX_BeatmapInfo_MetadataID",
table: "BeatmapInfo", table: "BeatmapInfo",
column: "MetadataId"); column: "MetadataID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_RulesetInfoId", name: "IX_BeatmapInfo_RulesetID",
table: "BeatmapInfo", table: "BeatmapInfo",
column: "RulesetInfoId"); column: "RulesetID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapMetadata_BeatmapSetInfoId", name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID",
table: "BeatmapMetadata",
column: "BeatmapSetInfoId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetFileInfo_BeatmapSetInfoId",
table: "BeatmapSetFileInfo", table: "BeatmapSetFileInfo",
column: "BeatmapSetInfoId"); column: "BeatmapSetInfoID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapSetFileInfo_FileInfoId", name: "IX_BeatmapSetFileInfo_FileInfoID",
table: "BeatmapSetFileInfo", table: "BeatmapSetFileInfo",
column: "FileInfoId"); column: "FileInfoID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapSetInfo_DeletePending", name: "IX_BeatmapSetInfo_DeletePending",
table: "BeatmapSetInfo", table: "BeatmapSetInfo",
column: "DeletePending"); column: "DeletePending");
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetInfo_MetadataID",
table: "BeatmapSetInfo",
column: "MetadataID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_FileInfo_Hash", name: "IX_FileInfo_Hash",
table: "FileInfo", table: "FileInfo",
@ -299,16 +302,16 @@ namespace osu.Game.Migrations
name: "BeatmapDifficulty"); name: "BeatmapDifficulty");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapMetadata"); name: "RulesetInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "RulesetInfo"); name: "BeatmapSetInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "FileInfo"); name: "FileInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapSetInfo"); name: "BeatmapMetadata");
} }
} }
} }

View File

@ -1,4 +1,7 @@
// <auto-generated /> // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// <auto-generated />
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
@ -10,7 +13,7 @@ using System;
namespace osu.Game.Migrations namespace osu.Game.Migrations
{ {
[DbContext(typeof(OsuDbContext))] [DbContext(typeof(OsuDbContext))]
[Migration("20171009205048_Init")] [Migration("20171014052545_Init")]
partial class Init partial class Init
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,7 +24,7 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<float>("ApproachRate"); b.Property<float>("ApproachRate");
@ -36,26 +39,28 @@ namespace osu.Game.Migrations
b.Property<float>("SliderTickRate"); b.Property<float>("SliderTickRate");
b.HasKey("Id"); b.HasKey("ID");
b.ToTable("BeatmapDifficulty"); b.ToTable("BeatmapDifficulty");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int>("AudioLeadIn"); b.Property<int>("AudioLeadIn");
b.Property<int>("BaseDifficultyID");
b.Property<int>("BeatDivisor"); b.Property<int>("BeatDivisor");
b.Property<int>("BeatmapDifficultyId"); b.Property<int>("BeatmapSetInfoID");
b.Property<int>("BeatmapSetInfoId");
b.Property<bool>("Countdown"); b.Property<bool>("Countdown");
b.Property<int>("DifficultyID");
b.Property<double>("DistanceSpacing"); b.Property<double>("DistanceSpacing");
b.Property<int>("GridSize"); b.Property<int>("GridSize");
@ -68,11 +73,11 @@ namespace osu.Game.Migrations
b.Property<string>("MD5Hash"); b.Property<string>("MD5Hash");
b.Property<int?>("MetadataId"); b.Property<int?>("MetadataID");
b.Property<string>("Path"); b.Property<string>("Path");
b.Property<int>("RulesetInfoId"); b.Property<int>("RulesetID");
b.Property<bool>("SpecialStyle"); b.Property<bool>("SpecialStyle");
@ -88,24 +93,24 @@ namespace osu.Game.Migrations
b.Property<bool>("WidescreenStoryboard"); b.Property<bool>("WidescreenStoryboard");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("BeatmapDifficultyId"); b.HasIndex("BeatmapSetInfoID");
b.HasIndex("BeatmapSetInfoId"); b.HasIndex("DifficultyID");
b.HasIndex("MD5Hash"); b.HasIndex("MD5Hash");
b.HasIndex("MetadataId"); b.HasIndex("MetadataID");
b.HasIndex("RulesetInfoId"); b.HasIndex("RulesetID");
b.ToTable("BeatmapInfo"); b.ToTable("BeatmapInfo");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("Artist"); b.Property<string>("Artist");
@ -118,8 +123,6 @@ namespace osu.Game.Migrations
b.Property<string>("BackgroundFile"); b.Property<string>("BackgroundFile");
b.Property<int>("BeatmapSetInfoId");
b.Property<int>("PreviewTime"); b.Property<int>("PreviewTime");
b.Property<string>("Source"); b.Property<string>("Source");
@ -130,56 +133,57 @@ namespace osu.Game.Migrations
b.Property<string>("TitleUnicode"); b.Property<string>("TitleUnicode");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId")
.IsUnique();
b.ToTable("BeatmapMetadata"); b.ToTable("BeatmapMetadata");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int>("BeatmapSetInfoId"); b.Property<int>("BeatmapSetInfoID");
b.Property<int>("FileInfoId"); b.Property<int>("FileInfoID");
b.Property<string>("Filename") b.Property<string>("Filename")
.IsRequired(); .IsRequired();
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId"); b.HasIndex("BeatmapSetInfoID");
b.HasIndex("FileInfoId"); b.HasIndex("FileInfoID");
b.ToTable("BeatmapSetFileInfo"); b.ToTable("BeatmapSetFileInfo");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<bool>("DeletePending"); b.Property<bool>("DeletePending");
b.Property<string>("Hash"); b.Property<string>("Hash");
b.Property<int?>("MetadataID");
b.Property<bool>("Protected"); b.Property<bool>("Protected");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("DeletePending"); b.HasIndex("DeletePending");
b.HasIndex("MetadataID");
b.ToTable("BeatmapSetInfo"); b.ToTable("BeatmapSetInfo");
}); });
modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int>("IntAction") b.Property<int>("IntAction")
@ -188,11 +192,11 @@ namespace osu.Game.Migrations
b.Property<string>("KeysString") b.Property<string>("KeysString")
.HasColumnName("Keys"); .HasColumnName("Keys");
b.Property<int?>("RulesetInfoId"); b.Property<int?>("RulesetID");
b.Property<int?>("Variant"); b.Property<int?>("Variant");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("IntAction"); b.HasIndex("IntAction");
@ -203,14 +207,14 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.IO.FileInfo", b => modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("Hash"); b.Property<string>("Hash");
b.Property<int>("ReferenceCount"); b.Property<int>("ReferenceCount");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("Hash") b.HasIndex("Hash")
.IsUnique(); .IsUnique();
@ -222,7 +226,7 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
{ {
b.Property<int?>("Id") b.Property<int?>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<bool>("Available"); b.Property<bool>("Available");
@ -231,7 +235,7 @@ namespace osu.Game.Migrations
b.Property<string>("Name"); b.Property<string>("Name");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("Available"); b.HasIndex("Available");
@ -246,31 +250,23 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty")
.WithMany()
.HasForeignKey("BeatmapDifficultyId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
.WithMany("Beatmaps") .WithMany("Beatmaps")
.HasForeignKey("BeatmapSetInfoId") .HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty")
.WithMany()
.HasForeignKey("DifficultyID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany() .WithMany()
.HasForeignKey("MetadataId"); .HasForeignKey("MetadataID");
b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
.WithMany() .WithMany()
.HasForeignKey("RulesetInfoId") .HasForeignKey("RulesetID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
.WithOne("Metadata")
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
@ -278,14 +274,21 @@ namespace osu.Game.Migrations
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
.WithMany("Files") .WithMany("Files")
.HasForeignKey("BeatmapSetInfoId") .HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.IO.FileInfo", "FileInfo") b.HasOne("osu.Game.IO.FileInfo", "FileInfo")
.WithMany() .WithMany()
.HasForeignKey("FileInfoId") .HasForeignKey("FileInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany()
.HasForeignKey("MetadataID");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

@ -1,4 +1,7 @@
// <auto-generated /> // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// <auto-generated />
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
@ -20,7 +23,7 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<float>("ApproachRate"); b.Property<float>("ApproachRate");
@ -35,26 +38,28 @@ namespace osu.Game.Migrations
b.Property<float>("SliderTickRate"); b.Property<float>("SliderTickRate");
b.HasKey("Id"); b.HasKey("ID");
b.ToTable("BeatmapDifficulty"); b.ToTable("BeatmapDifficulty");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int>("AudioLeadIn"); b.Property<int>("AudioLeadIn");
b.Property<int>("BaseDifficultyID");
b.Property<int>("BeatDivisor"); b.Property<int>("BeatDivisor");
b.Property<int>("BeatmapDifficultyId"); b.Property<int>("BeatmapSetInfoID");
b.Property<int>("BeatmapSetInfoId");
b.Property<bool>("Countdown"); b.Property<bool>("Countdown");
b.Property<int>("DifficultyID");
b.Property<double>("DistanceSpacing"); b.Property<double>("DistanceSpacing");
b.Property<int>("GridSize"); b.Property<int>("GridSize");
@ -67,11 +72,11 @@ namespace osu.Game.Migrations
b.Property<string>("MD5Hash"); b.Property<string>("MD5Hash");
b.Property<int?>("MetadataId"); b.Property<int?>("MetadataID");
b.Property<string>("Path"); b.Property<string>("Path");
b.Property<int>("RulesetInfoId"); b.Property<int>("RulesetID");
b.Property<bool>("SpecialStyle"); b.Property<bool>("SpecialStyle");
@ -87,24 +92,24 @@ namespace osu.Game.Migrations
b.Property<bool>("WidescreenStoryboard"); b.Property<bool>("WidescreenStoryboard");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("BeatmapDifficultyId"); b.HasIndex("BeatmapSetInfoID");
b.HasIndex("BeatmapSetInfoId"); b.HasIndex("DifficultyID");
b.HasIndex("MD5Hash"); b.HasIndex("MD5Hash");
b.HasIndex("MetadataId"); b.HasIndex("MetadataID");
b.HasIndex("RulesetInfoId"); b.HasIndex("RulesetID");
b.ToTable("BeatmapInfo"); b.ToTable("BeatmapInfo");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("Artist"); b.Property<string>("Artist");
@ -117,8 +122,6 @@ namespace osu.Game.Migrations
b.Property<string>("BackgroundFile"); b.Property<string>("BackgroundFile");
b.Property<int>("BeatmapSetInfoId");
b.Property<int>("PreviewTime"); b.Property<int>("PreviewTime");
b.Property<string>("Source"); b.Property<string>("Source");
@ -129,56 +132,57 @@ namespace osu.Game.Migrations
b.Property<string>("TitleUnicode"); b.Property<string>("TitleUnicode");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId")
.IsUnique();
b.ToTable("BeatmapMetadata"); b.ToTable("BeatmapMetadata");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int>("BeatmapSetInfoId"); b.Property<int>("BeatmapSetInfoID");
b.Property<int>("FileInfoId"); b.Property<int>("FileInfoID");
b.Property<string>("Filename") b.Property<string>("Filename")
.IsRequired(); .IsRequired();
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId"); b.HasIndex("BeatmapSetInfoID");
b.HasIndex("FileInfoId"); b.HasIndex("FileInfoID");
b.ToTable("BeatmapSetFileInfo"); b.ToTable("BeatmapSetFileInfo");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<bool>("DeletePending"); b.Property<bool>("DeletePending");
b.Property<string>("Hash"); b.Property<string>("Hash");
b.Property<int?>("MetadataID");
b.Property<bool>("Protected"); b.Property<bool>("Protected");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("DeletePending"); b.HasIndex("DeletePending");
b.HasIndex("MetadataID");
b.ToTable("BeatmapSetInfo"); b.ToTable("BeatmapSetInfo");
}); });
modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int>("IntAction") b.Property<int>("IntAction")
@ -187,11 +191,11 @@ namespace osu.Game.Migrations
b.Property<string>("KeysString") b.Property<string>("KeysString")
.HasColumnName("Keys"); .HasColumnName("Keys");
b.Property<int?>("RulesetInfoId"); b.Property<int?>("RulesetID");
b.Property<int?>("Variant"); b.Property<int?>("Variant");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("IntAction"); b.HasIndex("IntAction");
@ -202,14 +206,14 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.IO.FileInfo", b => modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
{ {
b.Property<int>("Id") b.Property<int>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("Hash"); b.Property<string>("Hash");
b.Property<int>("ReferenceCount"); b.Property<int>("ReferenceCount");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("Hash") b.HasIndex("Hash")
.IsUnique(); .IsUnique();
@ -221,7 +225,7 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
{ {
b.Property<int?>("Id") b.Property<int?>("ID")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<bool>("Available"); b.Property<bool>("Available");
@ -230,7 +234,7 @@ namespace osu.Game.Migrations
b.Property<string>("Name"); b.Property<string>("Name");
b.HasKey("Id"); b.HasKey("ID");
b.HasIndex("Available"); b.HasIndex("Available");
@ -245,31 +249,23 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty")
.WithMany()
.HasForeignKey("BeatmapDifficultyId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
.WithMany("Beatmaps") .WithMany("Beatmaps")
.HasForeignKey("BeatmapSetInfoId") .HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty")
.WithMany()
.HasForeignKey("DifficultyID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany() .WithMany()
.HasForeignKey("MetadataId"); .HasForeignKey("MetadataID");
b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
.WithMany() .WithMany()
.HasForeignKey("RulesetInfoId") .HasForeignKey("RulesetID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
.WithOne("Metadata")
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
@ -277,14 +273,21 @@ namespace osu.Game.Migrations
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
.WithMany("Files") .WithMany("Files")
.HasForeignKey("BeatmapSetInfoId") .HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.IO.FileInfo", "FileInfo") b.HasOne("osu.Game.IO.FileInfo", "FileInfo")
.WithMany() .WithMany()
.HasForeignKey("FileInfoId") .HasForeignKey("FileInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany()
.HasForeignKey("MetadataID");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

@ -19,6 +19,6 @@ namespace osu.Game.Online.API.Requests
Progress += (current, total) => DownloadProgressed?.Invoke((float) current / total); Progress += (current, total) => DownloadProgressed?.Invoke((float) current / total);
} }
protected override string Target => $@"beatmapsets/{BeatmapSet.BeatmapSetOnlineInfoId}/download"; protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download";
} }
} }

View File

@ -10,7 +10,7 @@ namespace osu.Game.Online.API.Requests
{ {
private readonly BeatmapInfo beatmap; private readonly BeatmapInfo beatmap;
private string lookupString => beatmap.BeatmapOnlineInfoId > 0 ? beatmap.BeatmapOnlineInfoId.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}"; private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}";
public GetBeatmapDetailsRequest(BeatmapInfo beatmap) public GetBeatmapDetailsRequest(BeatmapInfo beatmap)
{ {

View File

@ -40,7 +40,7 @@ namespace osu.Game.Online.API.Requests
{ {
return new BeatmapSetInfo return new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = onlineId, OnlineBeatmapSetID = onlineId,
Metadata = this, Metadata = this,
OnlineInfo = new BeatmapSetOnlineInfo OnlineInfo = new BeatmapSetOnlineInfo
{ {

View File

@ -19,8 +19,8 @@ namespace osu.Game.Online.API.Requests
public GetScoresRequest(BeatmapInfo beatmap) public GetScoresRequest(BeatmapInfo beatmap)
{ {
if (!beatmap.BeatmapOnlineInfoId.HasValue) if (!beatmap.OnlineBeatmapID.HasValue)
throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.BeatmapOnlineInfoId)}."); throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.OnlineBeatmapID)}.");
this.beatmap = beatmap; this.beatmap = beatmap;
@ -33,7 +33,7 @@ namespace osu.Game.Online.API.Requests
score.ApplyBeatmap(beatmap); score.ApplyBeatmap(beatmap);
} }
protected override string Target => $@"beatmaps/{beatmap.BeatmapOnlineInfoId}/scores"; protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores";
} }
public class GetScoresResponse public class GetScoresResponse

View File

@ -27,6 +27,6 @@ namespace osu.Game.Online.API.Requests
this.direction = direction; this.direction = direction;
} }
protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.Id ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}";
} }
} }

View File

@ -110,7 +110,7 @@ namespace osu.Game
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset); configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value); Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value);
Ruleset.ValueChanged += r => configRuleset.Value = r.Id ?? 0; Ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0;
} }
private ScheduledDelegate scoreLoad; private ScheduledDelegate scoreLoad;

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using System.Reflection; using System.Reflection;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -104,7 +103,7 @@ namespace osu.Game
dependencies.Cache(LocalConfig); dependencies.Cache(LocalConfig);
using (var dbContext = createDbContext()) using (var dbContext = createDbContext())
dbContext.Database.Migrate(); dbContext.Database.Migrate();
dependencies.Cache(API = new APIAccess dependencies.Cache(API = new APIAccess
{ {

View File

@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Direct
private void Bindable_ValueChanged(RulesetInfo obj) private void Bindable_ValueChanged(RulesetInfo obj)
{ {
iconContainer.FadeTo(Ruleset.Id == obj?.Id ? 1f : 0.5f, 100); iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100);
} }
public RulesetToggleButton(Bindable<RulesetInfo> bindable, RulesetInfo ruleset) public RulesetToggleButton(Bindable<RulesetInfo> bindable, RulesetInfo ruleset)

View File

@ -146,7 +146,7 @@ namespace osu.Game.Overlays.Direct
loading = true; loading = true;
Add(new AsyncLoadWrapper(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.BeatmapSetOnlineInfoId}.mp3") Add(new AsyncLoadWrapper(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.OnlineBeatmapSetID}.mp3")
{ {
OnLoadComplete = d => OnLoadComplete = d =>
{ {

View File

@ -176,8 +176,8 @@ namespace osu.Game.Overlays
private void setAdded(BeatmapSetInfo set) private void setAdded(BeatmapSetInfo set)
{ {
// if a new map was imported, we should remove it from search results (download completed etc.) // if a new map was imported, we should remove it from search results (download completed etc.)
panels?.FirstOrDefault(p => p.SetInfo.BeatmapSetOnlineInfoId == set.BeatmapSetOnlineInfoId)?.FadeOut(400).Expire(); panels?.FirstOrDefault(p => p.SetInfo.OnlineBeatmapSetID == set.OnlineBeatmapSetID)?.FadeOut(400).Expire();
BeatmapSets = BeatmapSets?.Where(b => b.BeatmapSetOnlineInfoId != set.BeatmapSetOnlineInfoId); BeatmapSets = BeatmapSets?.Where(b => b.OnlineBeatmapSetID != set.OnlineBeatmapSetID);
} }
private void updateResultCounts() private void updateResultCounts()
@ -278,7 +278,7 @@ namespace osu.Game.Overlays
{ {
BeatmapSets = r?. BeatmapSets = r?.
Select(response => response.ToBeatmapSet(rulesets)). Select(response => response.ToBeatmapSet(rulesets)).
Where(b => beatmaps.QueryBeatmapSet(q => q.BeatmapSetOnlineInfoId == b.BeatmapSetOnlineInfoId) == null); Where(b => beatmaps.QueryBeatmapSet(q => q.OnlineBeatmapSetID == b.OnlineBeatmapSetID) == null);
recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value);
}; };

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.KeyBinding
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(KeyBindingStore store) private void load(KeyBindingStore store)
{ {
var bindings = store.Query(Ruleset?.Id, variant); var bindings = store.Query(Ruleset?.ID, variant);
foreach (var defaultGroup in Defaults.GroupBy(d => d.Action)) foreach (var defaultGroup in Defaults.GroupBy(d => d.Action))
{ {

View File

@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Music
public bool RemoveBeatmapSet(BeatmapSetInfo beatmapSet) public bool RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
{ {
var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.Id == beatmapSet.Id); var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.ID == beatmapSet.ID);
if (itemToRemove == null) if (itemToRemove == null)
return false; return false;
return items.Remove(itemToRemove); return items.Remove(itemToRemove);
@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Music
set set
{ {
foreach (PlaylistItem s in items.Children) foreach (PlaylistItem s in items.Children)
s.Selected = s.BeatmapSetInfo.Id == value?.Id; s.Selected = s.BeatmapSetInfo.ID == value?.ID;
} }
} }

View File

@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Music
private void itemSelected(BeatmapSetInfo set) private void itemSelected(BeatmapSetInfo set)
{ {
if (set.Id == (beatmapBacking.Value?.BeatmapSetInfo?.Id ?? -1)) if (set.ID == (beatmapBacking.Value?.BeatmapSetInfo?.ID ?? -1))
{ {
beatmapBacking.Value?.Track?.Seek(0); beatmapBacking.Value?.Track?.Seek(0);
return; return;

View File

@ -308,8 +308,8 @@ namespace osu.Game.Overlays
else else
{ {
//figure out the best direction based on order in playlist. //figure out the best direction based on order in playlist.
var last = playlist.BeatmapSets.TakeWhile(b => b.Id != current.BeatmapSetInfo?.Id).Count(); var last = playlist.BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
var next = beatmap == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.Id != beatmap.BeatmapSetInfo?.Id).Count(); var next = beatmap == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != beatmap.BeatmapSetInfo?.ID).Count();
direction = last > next ? TransformDirection.Prev : TransformDirection.Next; direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
} }

View File

@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Action = () => Action = () =>
{ {
if (score.Beatmap.BeatmapSetOnlineInfoId.HasValue) beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.BeatmapSetOnlineInfoId.Value); if (score.Beatmap.OnlineBeatmapSetID.HasValue) beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.OnlineBeatmapSetID.Value);
}, },
Child = new FillFlowContainer Child = new FillFlowContainer
{ {

View File

@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
foreach (ToolbarModeButton m in modeButtons.Children.Cast<ToolbarModeButton>()) foreach (ToolbarModeButton m in modeButtons.Children.Cast<ToolbarModeButton>())
{ {
bool isActive = m.Ruleset.Id == ruleset.Id; bool isActive = m.Ruleset.ID == ruleset.ID;
m.Active = isActive; m.Active = isActive;
if (isActive) if (isActive)
activeButton = m; activeButton = m;

View File

@ -9,7 +9,7 @@ namespace osu.Game.Rulesets
public class RulesetInfo : IEquatable<RulesetInfo> public class RulesetInfo : IEquatable<RulesetInfo>
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int? Id { get; set; } public int? ID { get; set; }
public string Name { get; set; } public string Name { get; set; }
@ -19,6 +19,6 @@ namespace osu.Game.Rulesets
public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this); public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this);
public bool Equals(RulesetInfo other) => other != null && Id == other.Id && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo; public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;
} }
} }

View File

@ -49,7 +49,7 @@ namespace osu.Game.Rulesets
foreach (var r in instances.Where(r => r.LegacyID >= 0).OrderBy(r => r.LegacyID)) foreach (var r in instances.Where(r => r.LegacyID >= 0).OrderBy(r => r.LegacyID))
{ {
var rulesetInfo = createRulesetInfo(r); var rulesetInfo = createRulesetInfo(r);
if (Connection.RulesetInfo.SingleOrDefault(rsi=>rsi.Id==rulesetInfo.Id)==null) if (Connection.RulesetInfo.SingleOrDefault(rsi=>rsi.ID==rulesetInfo.ID)==null)
{ {
Connection.RulesetInfo.Add(rulesetInfo); Connection.RulesetInfo.Add(rulesetInfo);
} }
@ -103,12 +103,12 @@ namespace osu.Game.Rulesets
{ {
Name = ruleset.Description, Name = ruleset.Description,
InstantiationInfo = ruleset.GetType().AssemblyQualifiedName, InstantiationInfo = ruleset.GetType().AssemblyQualifiedName,
Id = ruleset.LegacyID ID = ruleset.LegacyID
}; };
protected override Type[] ValidTypes => new[] { typeof(RulesetInfo) }; protected override Type[] ValidTypes => new[] { typeof(RulesetInfo) };
public RulesetInfo GetRuleset(int id) => Connection.RulesetInfo.First(r => r.Id == id); public RulesetInfo GetRuleset(int id) => Connection.RulesetInfo.First(r => r.ID == id);
public RulesetInfo QueryRulesetInfo(Func<RulesetInfo, bool> query) public RulesetInfo QueryRulesetInfo(Func<RulesetInfo, bool> query)
{ {

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.Menu
{ {
var sets = beatmaps.GetAllUsableBeatmapSets(); var sets = beatmaps.GetAllUsableBeatmapSets();
if (sets.Count > 0) if (sets.Count > 0)
setInfo = beatmaps.QueryBeatmapSet(s => s.Id == sets[RNG.Next(0, sets.Count - 1)].Id); setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
} }
if (setInfo == null) if (setInfo == null)

View File

@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play
try try
{ {
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.Ruleset.Id); RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID);
} }
catch (BeatmapInvalidForRulesetException) catch (BeatmapInvalidForRulesetException)
{ {

View File

@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select
}); });
} }
public void RemoveBeatmap(BeatmapSetInfo beatmapSet) => removeGroup(groups.Find(b => b.BeatmapSet.Id == beatmapSet.Id)); public void RemoveBeatmap(BeatmapSetInfo beatmapSet) => removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID));
internal void UpdateBeatmap(BeatmapInfo beatmap) internal void UpdateBeatmap(BeatmapInfo beatmap)
{ {
@ -121,7 +121,7 @@ namespace osu.Game.Screens.Select
var set = manager.Refresh(beatmap.BeatmapSet); var set = manager.Refresh(beatmap.BeatmapSet);
// todo: this method should be smarter as to not recreate panels that haven't changed, etc. // todo: this method should be smarter as to not recreate panels that haven't changed, etc.
var group = groups.Find(b => b.BeatmapSet.Id == set.Id); var group = groups.Find(b => b.BeatmapSet.ID == set.ID);
if (group == null) if (group == null)
return; return;
@ -141,7 +141,7 @@ namespace osu.Game.Screens.Select
if (selectedGroup == group && newGroup.BeatmapPanels.Count > 0) if (selectedGroup == group && newGroup.BeatmapPanels.Count > 0)
{ {
var newSelection = var newSelection =
newGroup.BeatmapPanels.Find(p => p.Beatmap.Id == selectedPanel?.Beatmap.Id) ?? newGroup.BeatmapPanels.Find(p => p.Beatmap.ID == selectedPanel?.Beatmap.ID) ??
newGroup.BeatmapPanels[Math.Min(newGroup.BeatmapPanels.Count - 1, group.BeatmapPanels.IndexOf(selectedPanel))]; newGroup.BeatmapPanels[Math.Min(newGroup.BeatmapPanels.Count - 1, group.BeatmapPanels.IndexOf(selectedPanel))];
selectGroup(newGroup, newSelection); selectGroup(newGroup, newSelection);

View File

@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select.Details
beatmap = value; beatmap = value;
//mania specific //mania specific
if ((Beatmap?.Ruleset?.Id ?? 0) == 3) if ((Beatmap?.Ruleset?.ID ?? 0) == 3)
{ {
firstValue.Title = "Key Amount"; firstValue.Title = "Key Amount";
firstValue.Value = (int)Math.Round(Beatmap?.Difficulty?.CircleSize ?? 0); firstValue.Value = (int)Math.Round(Beatmap?.Difficulty?.CircleSize ?? 0);

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select
{ {
var set = g.BeatmapSet; var set = g.BeatmapSet;
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetInfoId == (Ruleset?.Id ?? 0)); bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0));
bool match = hasCurrentMode; bool match = hasCurrentMode;

View File

@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Scores = null; Scores = null;
getScoresRequest?.Cancel(); getScoresRequest?.Cancel();
if (api == null || Beatmap?.BeatmapOnlineInfoId == null) return; if (api == null || Beatmap?.OnlineBeatmapID == null) return;
loading.Show(); loading.Show();

View File

@ -246,7 +246,7 @@ namespace osu.Game.Screens.Select
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again. // In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true) if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true)
{ {
bool preview = beatmap?.BeatmapSetInfoId != Beatmap.Value.BeatmapInfo.BeatmapSetInfoId; bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
Beatmap.Value = manager.GetWorkingBeatmap(beatmap, Beatmap); Beatmap.Value = manager.GetWorkingBeatmap(beatmap, Beatmap);
ensurePlayingSelected(preview); ensurePlayingSelected(preview);
@ -269,7 +269,7 @@ namespace osu.Game.Screens.Select
} }
else else
{ {
if (beatmap.BeatmapSetInfoId == beatmapNoDebounce?.BeatmapSetInfoId) if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
sampleChangeDifficulty.Play(); sampleChangeDifficulty.Play();
else else
sampleChangeBeatmap.Play(); sampleChangeBeatmap.Play();

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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 Microsoft.Data.Sqlite;
using osu.Framework.Platform; using osu.Framework.Platform;
namespace osu.Game.Tests.Platform namespace osu.Game.Tests.Platform

View File

@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual
{ {
new BeatmapSetInfo new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 578332, OnlineBeatmapSetID = 578332,
Metadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"OrVid", Title = @"OrVid",
@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual
}, },
new BeatmapSetInfo new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 599627, OnlineBeatmapSetID = 599627,
Metadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"tiny lamp", Title = @"tiny lamp",
@ -105,7 +105,7 @@ namespace osu.Game.Tests.Visual
}, },
new BeatmapSetInfo new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 513268, OnlineBeatmapSetID = 513268,
Metadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"At Gwanghwamun", Title = @"At Gwanghwamun",
@ -152,7 +152,7 @@ namespace osu.Game.Tests.Visual
}, },
new BeatmapSetInfo new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 586841, OnlineBeatmapSetID = 586841,
Metadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
Title = @"RHAPSODY OF BLUE SKY", Title = @"RHAPSODY OF BLUE SKY",

View File

@ -60,11 +60,11 @@ namespace osu.Game.Tests.Visual
{ {
return new BeatmapSetInfo return new BeatmapSetInfo
{ {
BeatmapSetOnlineInfoId = 1234 + i, OnlineBeatmapSetID = 1234 + i,
Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249", Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
Metadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
BeatmapSetOnlineInfoId = 1234 + i, OnlineBeatmapSetID = 1234 + i,
// Create random metadata, then we can check if sorting works based on these // Create random metadata, then we can check if sorting works based on these
Artist = "MONACA " + RNG.Next(0, 9), Artist = "MONACA " + RNG.Next(0, 9),
Title = "Black Song " + RNG.Next(0, 9), Title = "Black Song " + RNG.Next(0, 9),
@ -74,7 +74,7 @@ namespace osu.Game.Tests.Visual
{ {
new BeatmapInfo new BeatmapInfo
{ {
BeatmapOnlineInfoId = 1234 + i, OnlineBeatmapID = 1234 + i,
Ruleset = rulesets.QueryRulesets().First(), Ruleset = rulesets.QueryRulesets().First(),
Path = "normal.osu", Path = "normal.osu",
Version = "Normal", Version = "Normal",
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual
}, },
new BeatmapInfo new BeatmapInfo
{ {
BeatmapOnlineInfoId = 1235 + i, OnlineBeatmapID = 1235 + i,
Ruleset = rulesets.QueryRulesets().First(), Ruleset = rulesets.QueryRulesets().First(),
Path = "hard.osu", Path = "hard.osu",
Version = "Hard", Version = "Hard",
@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual
}, },
new BeatmapInfo new BeatmapInfo
{ {
BeatmapOnlineInfoId = 1236 + i, OnlineBeatmapID = 1236 + i,
Ruleset = rulesets.QueryRulesets().First(), Ruleset = rulesets.QueryRulesets().First(),
Path = "insane.osu", Path = "insane.osu",
Version = "Insane", Version = "Insane",

View File

@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual
if (beatmap == null) if (beatmap == null)
{ {
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetInfoId == 0); var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0);
if (beatmapInfo != null) if (beatmapInfo != null)
beatmap = beatmaps.GetWorkingBeatmap(beatmapInfo); beatmap = beatmaps.GetWorkingBeatmap(beatmapInfo);
} }

View File

@ -323,6 +323,11 @@
<Compile Include="Beatmaps\Drawables\BeatmapPanel.cs" /> <Compile Include="Beatmaps\Drawables\BeatmapPanel.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" /> <Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" /> <Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" />
<Compile Include="Migrations\20171014052545_Init.cs" />
<Compile Include="Migrations\20171014052545_Init.designer.cs">
<DependentUpon>20171014052545_Init.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" /> <Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" />
@ -425,11 +430,6 @@
<Compile Include="IO\Serialization\IJsonSerializable.cs" /> <Compile Include="IO\Serialization\IJsonSerializable.cs" />
<Compile Include="IPC\BeatmapIPCChannel.cs" /> <Compile Include="IPC\BeatmapIPCChannel.cs" />
<Compile Include="IPC\ScoreIPCChannel.cs" /> <Compile Include="IPC\ScoreIPCChannel.cs" />
<Compile Include="Migrations\20171009205048_Init.cs" />
<Compile Include="Migrations\20171009205048_Init.designer.cs">
<DependentUpon>20171009205048_Init.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
<Compile Include="Online\API\APIAccess.cs" /> <Compile Include="Online\API\APIAccess.cs" />
<Compile Include="Online\API\APIRequest.cs" /> <Compile Include="Online\API\APIRequest.cs" />
<Compile Include="Online\API\IOnlineComponent.cs" /> <Compile Include="Online\API\IOnlineComponent.cs" />