1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 00:02:54 +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);
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
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 meta = beatmap.BeatmapInfo.Metadata;
Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId);
Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
Assert.AreEqual("Soleily", meta.Artist);
Assert.AreEqual("Soleily", meta.ArtistUnicode);
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(0.7f, beatmapInfo.StackLeniency);
Assert.AreEqual(false, beatmapInfo.SpecialStyle);
Assert.IsTrue(beatmapInfo.RulesetInfoId == 0);
Assert.IsTrue(beatmapInfo.RulesetID == 0);
Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks);
Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard);
}

View File

@ -111,14 +111,14 @@ namespace osu.Game.Tests.Beatmaps.IO
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);
//ensure we were stored to beatmap database backing...
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<BeatmapSetInfo>> queryBeatmapSets = () => store.QueryBeatmapSets(s => s.BeatmapSetOnlineInfoId == 241526);
Func<IEnumerable<BeatmapInfo>> queryBeatmaps = () => store.QueryBeatmaps(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0);
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.
waitForOrAssert(() => queryBeatmaps().Count() == 12,
@ -141,16 +141,16 @@ namespace osu.Game.Tests.Beatmaps.IO
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);
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);
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);
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);
}

View File

@ -52,7 +52,7 @@ namespace osu.Game.Tests.Beatmaps.IO
using (var stream = new StreamReader(reader.GetStream("Soleily - Renatus (Deif) [Platter].osu")))
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.ArtistUnicode);
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;
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int ID { get; set; }
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
public float CircleSize { 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
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int ID { get; set; }
//TODO: should be in database
public int BeatmapVersion;
[JsonProperty("id")]
[NotMapped]
public int? BeatmapOnlineInfoId { get; set; }
public int? OnlineBeatmapID { get; set; }
[JsonProperty("beatmapset_id")]
[NotMapped]
public int? BeatmapSetOnlineInfoId { get; set; }
public int? OnlineBeatmapSetID { get; set; }
public int BeatmapSetInfoId { get; set; }
public int BeatmapSetInfoID { get; set; }
[Required]
public BeatmapSetInfo BeatmapSet { get; set; }
public BeatmapMetadata Metadata { get; set; }
public int BeatmapDifficultyId { get; set; }
public int BaseDifficultyID { get; set; }
[Required]
public BeatmapDifficulty Difficulty { get; set; }
@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps
public float StackLeniency { get; set; }
public bool SpecialStyle { get; set; }
public int RulesetInfoId { get; set; }
public int RulesetID { get; set; }
public RulesetInfo Ruleset { get; set; }
@ -109,12 +109,12 @@ namespace osu.Game.Beatmaps
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.
// fall back to reference equality.
return ReferenceEquals(this, other);
return Id == other?.Id;
return ID == other?.ID;
}
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)
{
// 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);
}
@ -251,7 +251,7 @@ namespace osu.Game.Beatmaps
/// </summary>
/// <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>
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>
/// Delete a beatmap from the manager.
@ -303,7 +303,7 @@ namespace osu.Game.Beatmaps
return DefaultBeatmap;
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)
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
@ -344,7 +344,7 @@ namespace osu.Game.Beatmaps
/// </summary>
/// <param name="beatmapSet">A stale instance.</param>
/// <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>
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
@ -449,7 +449,7 @@ namespace osu.Game.Beatmaps
beatmapSet = new BeatmapSetInfo
{
BeatmapSetOnlineInfoId = metadata.BeatmapSetOnlineInfoId,
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
Beatmaps = new List<BeatmapInfo>(),
Hash = hash,
Files = fileInfos,
@ -478,8 +478,8 @@ namespace osu.Game.Beatmaps
beatmap.BeatmapInfo.Metadata = null;
// 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.StarDifficulty = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId)?.CreateInstance()?.CreateDifficultyCalculator(beatmap)
beatmap.BeatmapInfo.Ruleset = rulesets.QueryRulesetInfo(r => r.ID == beatmap.BeatmapInfo.RulesetID);
beatmap.BeatmapInfo.StarDifficulty = rulesets.QueryRulesetInfo(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap)
.Calculate() ?? 0;
beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);

View File

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

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace osu.Game.Beatmaps
@ -11,9 +10,6 @@ namespace osu.Game.Beatmaps
/// </summary>
public class BeatmapOnlineInfo
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
/// <summary>
/// The length in milliseconds of this beatmap's song.
/// </summary>

View File

@ -10,11 +10,11 @@ namespace osu.Game.Beatmaps
public class BeatmapSetFileInfo
{
[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; }

View File

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

View File

@ -97,9 +97,9 @@ namespace osu.Game.Beatmaps.Formats
beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
break;
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:
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser();
@ -183,11 +183,11 @@ namespace osu.Game.Beatmaps.Formats
beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
break;
case @"BeatmapID":
beatmap.BeatmapInfo.BeatmapOnlineInfoId = int.Parse(pair.Value);
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(pair.Value);
break;
case @"BeatmapSetID":
beatmap.BeatmapInfo.BeatmapSetOnlineInfoId = int.Parse(pair.Value);
metadata.BeatmapSetOnlineInfoId = int.Parse(pair.Value);
beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(pair.Value);
metadata.OnlineBeatmapSetID = int.Parse(pair.Value);
break;
}
}

View File

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

View File

@ -85,9 +85,9 @@ namespace osu.Game.IO
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();
return accurateRefCount;
});
@ -96,9 +96,9 @@ namespace osu.Game.IO
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();
return accurateRefCount;
});

View File

@ -10,9 +10,9 @@ namespace osu.Game.Input.Bindings
public class DatabasedKeyBinding : KeyBinding
{
[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; }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Input.Bindings
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();
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,
Action = insertable.Action,
RulesetInfoId = rulesetId,
RulesetID = rulesetId,
Variant = variant
});
Connection.SaveChanges();
@ -62,7 +62,7 @@ namespace osu.Game.Input
};
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)
{

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.Collections.Generic;
@ -12,7 +15,7 @@ namespace osu.Game.Migrations
name: "BeatmapDifficulty",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ApproachRate = 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 =>
{
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);
table.PrimaryKey("PK_BeatmapDifficulty", x => x.ID);
});
migrationBuilder.CreateTable(
name: "BeatmapMetadata",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Artist = table.Column<string>(type: "TEXT", nullable: true),
ArtistUnicode = table.Column<string>(type: "TEXT", nullable: true),
AudioFile = table.Column<string>(type: "TEXT", nullable: true),
Author = 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),
Source = 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 =>
{
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);
table.PrimaryKey("PK_BeatmapMetadata", x => x.ID);
});
migrationBuilder.CreateTable(
name: "BeatmapSetFileInfo",
name: "FileInfo",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
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)
Hash = table.Column<string>(type: "TEXT", nullable: true),
ReferenceCount = table.Column<int>(type: "INTEGER", nullable: false)
},
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(
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);
name: "FK_BeatmapSetInfo_BeatmapMetadata_MetadataID",
column: x => x.MetadataID,
principalTable: "BeatmapMetadata",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "BeatmapInfo",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AudioLeadIn = table.Column<int>(type: "INTEGER", nullable: false),
BaseDifficultyID = 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),
DifficultyID = table.Column<int>(type: "INTEGER", nullable: false),
DistanceSpacing = table.Column<double>(type: "REAL", nullable: false),
GridSize = table.Column<int>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true),
Hidden = table.Column<bool>(type: "INTEGER", nullable: false),
LetterboxInBreaks = table.Column<bool>(type: "INTEGER", nullable: false),
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),
RulesetInfoId = table.Column<int>(type: "INTEGER", nullable: false),
RulesetID = table.Column<int>(type: "INTEGER", nullable: false),
SpecialStyle = table.Column<bool>(type: "INTEGER", nullable: false),
StackLeniency = table.Column<float>(type: "REAL", nullable: false),
StarDifficulty = table.Column<double>(type: "REAL", nullable: false),
@ -172,42 +149,69 @@ namespace osu.Game.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapInfo", x => x.Id);
table.PrimaryKey("PK_BeatmapInfo", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapDifficulty_BeatmapDifficultyId",
column: x => x.BeatmapDifficultyId,
principalTable: "BeatmapDifficulty",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoId",
column: x => x.BeatmapSetInfoId,
name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapSetInfo",
principalColumn: "Id",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapMetadata_MetadataId",
column: x => x.MetadataId,
name: "FK_BeatmapInfo_BeatmapDifficulty_DifficultyID",
column: x => x.DifficultyID,
principalTable: "BeatmapDifficulty",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapMetadata_MetadataID",
column: x => x.MetadataID,
principalTable: "BeatmapMetadata",
principalColumn: "Id",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BeatmapInfo_RulesetInfo_RulesetInfoId",
column: x => x.RulesetInfoId,
name: "FK_BeatmapInfo_RulesetInfo_RulesetID",
column: x => x.RulesetID,
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);
});
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_BeatmapDifficultyId",
name: "IX_BeatmapInfo_BeatmapSetInfoID",
table: "BeatmapInfo",
column: "BeatmapDifficultyId");
column: "BeatmapSetInfoID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_BeatmapSetInfoId",
name: "IX_BeatmapInfo_DifficultyID",
table: "BeatmapInfo",
column: "BeatmapSetInfoId");
column: "DifficultyID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_MD5Hash",
@ -215,36 +219,35 @@ namespace osu.Game.Migrations
column: "MD5Hash");
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_MetadataId",
name: "IX_BeatmapInfo_MetadataID",
table: "BeatmapInfo",
column: "MetadataId");
column: "MetadataID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_RulesetInfoId",
name: "IX_BeatmapInfo_RulesetID",
table: "BeatmapInfo",
column: "RulesetInfoId");
column: "RulesetID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapMetadata_BeatmapSetInfoId",
table: "BeatmapMetadata",
column: "BeatmapSetInfoId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetFileInfo_BeatmapSetInfoId",
name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID",
table: "BeatmapSetFileInfo",
column: "BeatmapSetInfoId");
column: "BeatmapSetInfoID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetFileInfo_FileInfoId",
name: "IX_BeatmapSetFileInfo_FileInfoID",
table: "BeatmapSetFileInfo",
column: "FileInfoId");
column: "FileInfoID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetInfo_DeletePending",
table: "BeatmapSetInfo",
column: "DeletePending");
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetInfo_MetadataID",
table: "BeatmapSetInfo",
column: "MetadataID");
migrationBuilder.CreateIndex(
name: "IX_FileInfo_Hash",
table: "FileInfo",
@ -299,16 +302,16 @@ namespace osu.Game.Migrations
name: "BeatmapDifficulty");
migrationBuilder.DropTable(
name: "BeatmapMetadata");
name: "RulesetInfo");
migrationBuilder.DropTable(
name: "RulesetInfo");
name: "BeatmapSetInfo");
migrationBuilder.DropTable(
name: "FileInfo");
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.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
@ -10,7 +13,7 @@ using System;
namespace osu.Game.Migrations
{
[DbContext(typeof(OsuDbContext))]
[Migration("20171009205048_Init")]
[Migration("20171014052545_Init")]
partial class Init
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -21,7 +24,7 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<float>("ApproachRate");
@ -36,26 +39,28 @@ namespace osu.Game.Migrations
b.Property<float>("SliderTickRate");
b.HasKey("Id");
b.HasKey("ID");
b.ToTable("BeatmapDifficulty");
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("AudioLeadIn");
b.Property<int>("BaseDifficultyID");
b.Property<int>("BeatDivisor");
b.Property<int>("BeatmapDifficultyId");
b.Property<int>("BeatmapSetInfoId");
b.Property<int>("BeatmapSetInfoID");
b.Property<bool>("Countdown");
b.Property<int>("DifficultyID");
b.Property<double>("DistanceSpacing");
b.Property<int>("GridSize");
@ -68,11 +73,11 @@ namespace osu.Game.Migrations
b.Property<string>("MD5Hash");
b.Property<int?>("MetadataId");
b.Property<int?>("MetadataID");
b.Property<string>("Path");
b.Property<int>("RulesetInfoId");
b.Property<int>("RulesetID");
b.Property<bool>("SpecialStyle");
@ -88,24 +93,24 @@ namespace osu.Game.Migrations
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("MetadataId");
b.HasIndex("MetadataID");
b.HasIndex("RulesetInfoId");
b.HasIndex("RulesetID");
b.ToTable("BeatmapInfo");
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Artist");
@ -118,8 +123,6 @@ namespace osu.Game.Migrations
b.Property<string>("BackgroundFile");
b.Property<int>("BeatmapSetInfoId");
b.Property<int>("PreviewTime");
b.Property<string>("Source");
@ -130,56 +133,57 @@ namespace osu.Game.Migrations
b.Property<string>("TitleUnicode");
b.HasKey("Id");
b.HasIndex("BeatmapSetInfoId")
.IsUnique();
b.HasKey("ID");
b.ToTable("BeatmapMetadata");
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("BeatmapSetInfoId");
b.Property<int>("BeatmapSetInfoID");
b.Property<int>("FileInfoId");
b.Property<int>("FileInfoID");
b.Property<string>("Filename")
.IsRequired();
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId");
b.HasIndex("BeatmapSetInfoID");
b.HasIndex("FileInfoId");
b.HasIndex("FileInfoID");
b.ToTable("BeatmapSetFileInfo");
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<bool>("DeletePending");
b.Property<string>("Hash");
b.Property<int?>("MetadataID");
b.Property<bool>("Protected");
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("DeletePending");
b.HasIndex("MetadataID");
b.ToTable("BeatmapSetInfo");
});
modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("IntAction")
@ -188,11 +192,11 @@ namespace osu.Game.Migrations
b.Property<string>("KeysString")
.HasColumnName("Keys");
b.Property<int?>("RulesetInfoId");
b.Property<int?>("RulesetID");
b.Property<int?>("Variant");
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("IntAction");
@ -203,14 +207,14 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Hash");
b.Property<int>("ReferenceCount");
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("Hash")
.IsUnique();
@ -222,7 +226,7 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
{
b.Property<int?>("Id")
b.Property<int?>("ID")
.ValueGeneratedOnAdd();
b.Property<bool>("Available");
@ -231,7 +235,7 @@ namespace osu.Game.Migrations
b.Property<string>("Name");
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("Available");
@ -246,31 +250,23 @@ namespace osu.Game.Migrations
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")
.WithMany("Beatmaps")
.HasForeignKey("BeatmapSetInfoId")
.HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty")
.WithMany()
.HasForeignKey("DifficultyID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany()
.HasForeignKey("MetadataId");
.HasForeignKey("MetadataID");
b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
.WithMany()
.HasForeignKey("RulesetInfoId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
.WithOne("Metadata")
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoId")
.HasForeignKey("RulesetID")
.OnDelete(DeleteBehavior.Cascade);
});
@ -278,14 +274,21 @@ namespace osu.Game.Migrations
{
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
.WithMany("Files")
.HasForeignKey("BeatmapSetInfoId")
.HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.IO.FileInfo", "FileInfo")
.WithMany()
.HasForeignKey("FileInfoId")
.HasForeignKey("FileInfoID")
.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
}
}

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.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
@ -20,7 +23,7 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<float>("ApproachRate");
@ -35,26 +38,28 @@ namespace osu.Game.Migrations
b.Property<float>("SliderTickRate");
b.HasKey("Id");
b.HasKey("ID");
b.ToTable("BeatmapDifficulty");
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("AudioLeadIn");
b.Property<int>("BaseDifficultyID");
b.Property<int>("BeatDivisor");
b.Property<int>("BeatmapDifficultyId");
b.Property<int>("BeatmapSetInfoId");
b.Property<int>("BeatmapSetInfoID");
b.Property<bool>("Countdown");
b.Property<int>("DifficultyID");
b.Property<double>("DistanceSpacing");
b.Property<int>("GridSize");
@ -67,11 +72,11 @@ namespace osu.Game.Migrations
b.Property<string>("MD5Hash");
b.Property<int?>("MetadataId");
b.Property<int?>("MetadataID");
b.Property<string>("Path");
b.Property<int>("RulesetInfoId");
b.Property<int>("RulesetID");
b.Property<bool>("SpecialStyle");
@ -87,24 +92,24 @@ namespace osu.Game.Migrations
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("MetadataId");
b.HasIndex("MetadataID");
b.HasIndex("RulesetInfoId");
b.HasIndex("RulesetID");
b.ToTable("BeatmapInfo");
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Artist");
@ -117,8 +122,6 @@ namespace osu.Game.Migrations
b.Property<string>("BackgroundFile");
b.Property<int>("BeatmapSetInfoId");
b.Property<int>("PreviewTime");
b.Property<string>("Source");
@ -129,56 +132,57 @@ namespace osu.Game.Migrations
b.Property<string>("TitleUnicode");
b.HasKey("Id");
b.HasIndex("BeatmapSetInfoId")
.IsUnique();
b.HasKey("ID");
b.ToTable("BeatmapMetadata");
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("BeatmapSetInfoId");
b.Property<int>("BeatmapSetInfoID");
b.Property<int>("FileInfoId");
b.Property<int>("FileInfoID");
b.Property<string>("Filename")
.IsRequired();
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId");
b.HasIndex("BeatmapSetInfoID");
b.HasIndex("FileInfoId");
b.HasIndex("FileInfoID");
b.ToTable("BeatmapSetFileInfo");
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<bool>("DeletePending");
b.Property<string>("Hash");
b.Property<int?>("MetadataID");
b.Property<bool>("Protected");
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("DeletePending");
b.HasIndex("MetadataID");
b.ToTable("BeatmapSetInfo");
});
modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("IntAction")
@ -187,11 +191,11 @@ namespace osu.Game.Migrations
b.Property<string>("KeysString")
.HasColumnName("Keys");
b.Property<int?>("RulesetInfoId");
b.Property<int?>("RulesetID");
b.Property<int?>("Variant");
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("IntAction");
@ -202,14 +206,14 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.IO.FileInfo", b =>
{
b.Property<int>("Id")
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Hash");
b.Property<int>("ReferenceCount");
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("Hash")
.IsUnique();
@ -221,7 +225,7 @@ namespace osu.Game.Migrations
modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b =>
{
b.Property<int?>("Id")
b.Property<int?>("ID")
.ValueGeneratedOnAdd();
b.Property<bool>("Available");
@ -230,7 +234,7 @@ namespace osu.Game.Migrations
b.Property<string>("Name");
b.HasKey("Id");
b.HasKey("ID");
b.HasIndex("Available");
@ -245,31 +249,23 @@ namespace osu.Game.Migrations
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")
.WithMany("Beatmaps")
.HasForeignKey("BeatmapSetInfoId")
.HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty")
.WithMany()
.HasForeignKey("DifficultyID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany()
.HasForeignKey("MetadataId");
.HasForeignKey("MetadataID");
b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
.WithMany()
.HasForeignKey("RulesetInfoId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
.WithOne("Metadata")
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoId")
.HasForeignKey("RulesetID")
.OnDelete(DeleteBehavior.Cascade);
});
@ -277,14 +273,21 @@ namespace osu.Game.Migrations
{
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
.WithMany("Files")
.HasForeignKey("BeatmapSetInfoId")
.HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.IO.FileInfo", "FileInfo")
.WithMany()
.HasForeignKey("FileInfoId")
.HasForeignKey("FileInfoID")
.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
}
}

View File

@ -19,6 +19,6 @@ namespace osu.Game.Online.API.Requests
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 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)
{

View File

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

View File

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

View File

@ -27,6 +27,6 @@ namespace osu.Game.Online.API.Requests
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);
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;

View File

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

View File

@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Direct
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)

View File

@ -146,7 +146,7 @@ namespace osu.Game.Overlays.Direct
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 =>
{

View File

@ -176,8 +176,8 @@ namespace osu.Game.Overlays
private void setAdded(BeatmapSetInfo set)
{
// 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();
BeatmapSets = BeatmapSets?.Where(b => b.BeatmapSetOnlineInfoId != set.BeatmapSetOnlineInfoId);
panels?.FirstOrDefault(p => p.SetInfo.OnlineBeatmapSetID == set.OnlineBeatmapSetID)?.FadeOut(400).Expire();
BeatmapSets = BeatmapSets?.Where(b => b.OnlineBeatmapSetID != set.OnlineBeatmapSetID);
}
private void updateResultCounts()
@ -278,7 +278,7 @@ namespace osu.Game.Overlays
{
BeatmapSets = r?.
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);
};

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.KeyBinding
[BackgroundDependencyLoader]
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))
{

View File

@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Music
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)
return false;
return items.Remove(itemToRemove);
@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Music
set
{
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)
{
if (set.Id == (beatmapBacking.Value?.BeatmapSetInfo?.Id ?? -1))
if (set.ID == (beatmapBacking.Value?.BeatmapSetInfo?.ID ?? -1))
{
beatmapBacking.Value?.Track?.Seek(0);
return;

View File

@ -308,8 +308,8 @@ namespace osu.Game.Overlays
else
{
//figure out the best direction based on order in playlist.
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 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();
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
}

View File

@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
AutoSizeAxes = Axes.Both,
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
{

View File

@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Toolbar
{
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;
if (isActive)
activeButton = m;

View File

@ -9,7 +9,7 @@ namespace osu.Game.Rulesets
public class RulesetInfo : IEquatable<RulesetInfo>
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int? Id { get; set; }
public int? ID { 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 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))
{
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);
}
@ -103,12 +103,12 @@ namespace osu.Game.Rulesets
{
Name = ruleset.Description,
InstantiationInfo = ruleset.GetType().AssemblyQualifiedName,
Id = ruleset.LegacyID
ID = ruleset.LegacyID
};
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)
{

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.Menu
{
var sets = beatmaps.GetAllUsableBeatmapSets();
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)

View File

@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play
try
{
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.Ruleset.Id);
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID);
}
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)
{
@ -121,7 +121,7 @@ namespace osu.Game.Screens.Select
var set = manager.Refresh(beatmap.BeatmapSet);
// 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)
return;
@ -141,7 +141,7 @@ namespace osu.Game.Screens.Select
if (selectedGroup == group && newGroup.BeatmapPanels.Count > 0)
{
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))];
selectGroup(newGroup, newSelection);

View File

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

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select
{
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;

View File

@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Scores = null;
getScoresRequest?.Cancel();
if (api == null || Beatmap?.BeatmapOnlineInfoId == null) return;
if (api == null || Beatmap?.OnlineBeatmapID == null) return;
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.
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);
ensurePlayingSelected(preview);
@ -269,7 +269,7 @@ namespace osu.Game.Screens.Select
}
else
{
if (beatmap.BeatmapSetInfoId == beatmapNoDebounce?.BeatmapSetInfoId)
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
sampleChangeDifficulty.Play();
else
sampleChangeBeatmap.Play();

View File

@ -1,7 +1,6 @@
// 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.Data.Sqlite;
using osu.Framework.Platform;
namespace osu.Game.Tests.Platform

View File

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

View File

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

View File

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

View File

@ -323,6 +323,11 @@
<Compile Include="Beatmaps\Drawables\BeatmapPanel.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.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\GetBeatmapSetsResponse.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" />
@ -425,11 +430,6 @@
<Compile Include="IO\Serialization\IJsonSerializable.cs" />
<Compile Include="IPC\BeatmapIPCChannel.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\APIRequest.cs" />
<Compile Include="Online\API\IOnlineComponent.cs" />