1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 18:33:22 +08:00

Fix removal of FileInfo, BeatmapMetadata, BeatmapDifficulty objects

This commit is contained in:
TocoToucan 2017-10-15 14:01:35 +03:00
parent 7cf5d63cd3
commit db2750592d
8 changed files with 192 additions and 172 deletions

View File

@ -14,6 +14,7 @@ namespace osu.Game.Beatmaps
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; } public int ID { get; set; }
public int BeatmapInfoId { 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

@ -15,6 +15,7 @@ namespace osu.Game.Beatmaps
[NotMapped] [NotMapped]
public int? OnlineBeatmapSetID { 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

@ -73,6 +73,11 @@ namespace osu.Game.Beatmaps
if (beatmapSet.DeletePending) return false; if (beatmapSet.DeletePending) return false;
beatmapSet.DeletePending = true; beatmapSet.DeletePending = true;
// We can't use one to one relationship with its cascade delete because FileInfo can be used not only inside of BeatmapSetFileInfo
var files = beatmapSet.Files.Select(beatmapSetFileInfo => beatmapSetFileInfo.FileInfo);
Connection.FileInfo.RemoveRange(files);
Connection.BeatmapSetInfo.Remove(beatmapSet); Connection.BeatmapSetInfo.Remove(beatmapSet);
Connection.SaveChanges(); Connection.SaveChanges();

View File

@ -1,7 +1,4 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // <auto-generated />
// 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;
@ -13,7 +10,7 @@ using System;
namespace osu.Game.Migrations namespace osu.Game.Migrations
{ {
[DbContext(typeof(OsuDbContext))] [DbContext(typeof(OsuDbContext))]
[Migration("20171014052545_Init")] [Migration("20171015101238_Init")]
partial class Init partial class Init
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -29,6 +26,8 @@ namespace osu.Game.Migrations
b.Property<float>("ApproachRate"); b.Property<float>("ApproachRate");
b.Property<int>("BeatmapInfoId");
b.Property<float>("CircleSize"); b.Property<float>("CircleSize");
b.Property<float>("DrainRate"); b.Property<float>("DrainRate");
@ -41,6 +40,9 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapInfoId")
.IsUnique();
b.ToTable("BeatmapDifficulty"); b.ToTable("BeatmapDifficulty");
}); });
@ -59,8 +61,6 @@ namespace osu.Game.Migrations
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");
@ -97,8 +97,6 @@ namespace osu.Game.Migrations
b.HasIndex("BeatmapSetInfoID"); b.HasIndex("BeatmapSetInfoID");
b.HasIndex("DifficultyID");
b.HasIndex("MD5Hash"); b.HasIndex("MD5Hash");
b.HasIndex("MetadataID"); b.HasIndex("MetadataID");
@ -119,10 +117,13 @@ namespace osu.Game.Migrations
b.Property<string>("AudioFile"); b.Property<string>("AudioFile");
b.Property<string>("Author"); b.Property<string>("AuthorString")
.HasColumnName("Author");
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");
@ -135,6 +136,9 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId")
.IsUnique();
b.ToTable("BeatmapMetadata"); b.ToTable("BeatmapMetadata");
}); });
@ -168,16 +172,12 @@ namespace osu.Game.Migrations
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");
}); });
@ -248,6 +248,14 @@ namespace osu.Game.Migrations
b.ToTable("RulesetInfo"); b.ToTable("RulesetInfo");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapInfo")
.WithOne("Difficulty")
.HasForeignKey("osu.Game.Beatmaps.BeatmapDifficulty", "BeatmapInfoId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
@ -255,11 +263,6 @@ namespace osu.Game.Migrations
.HasForeignKey("BeatmapSetInfoID") .HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty")
.WithMany()
.HasForeignKey("DifficultyID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany() .WithMany()
.HasForeignKey("MetadataID"); .HasForeignKey("MetadataID");
@ -270,6 +273,14 @@ namespace osu.Game.Migrations
.OnDelete(DeleteBehavior.Cascade); .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);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
@ -282,13 +293,6 @@ namespace osu.Game.Migrations
.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,7 +1,4 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. using Microsoft.EntityFrameworkCore.Migrations;
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Microsoft.EntityFrameworkCore.Migrations;
namespace osu.Game.Migrations namespace osu.Game.Migrations
{ {
@ -10,43 +7,18 @@ namespace osu.Game.Migrations
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapDifficulty", name: "BeatmapSetInfo",
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), DeletePending = table.Column<bool>(type: "INTEGER", nullable: false),
CircleSize = table.Column<float>(type: "REAL", nullable: false), Hash = table.Column<string>(type: "TEXT", nullable: true),
DrainRate = table.Column<float>(type: "REAL", nullable: false), Protected = table.Column<bool>(type: "INTEGER", nullable: false)
OverallDifficulty = table.Column<float>(type: "REAL", nullable: false),
SliderMultiplier = table.Column<float>(type: "REAL", nullable: false),
SliderTickRate = table.Column<float>(type: "REAL", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_BeatmapDifficulty", x => x.ID); table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID);
});
migrationBuilder.CreateTable(
name: "BeatmapMetadata",
columns: table => new
{
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),
PreviewTime = table.Column<int>(type: "INTEGER", nullable: false),
Source = table.Column<string>(type: "TEXT", nullable: true),
Tags = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: true),
TitleUnicode = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapMetadata", x => x.ID);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -95,83 +67,32 @@ namespace osu.Game.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapSetInfo", 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),
DeletePending = table.Column<bool>(type: "INTEGER", nullable: false), Artist = table.Column<string>(type: "TEXT", nullable: true),
Hash = table.Column<string>(type: "TEXT", nullable: true), ArtistUnicode = table.Column<string>(type: "TEXT", nullable: true),
MetadataID = table.Column<int>(type: "INTEGER", nullable: true), AudioFile = table.Column<string>(type: "TEXT", nullable: true),
Protected = table.Column<bool>(type: "INTEGER", nullable: false) 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),
Title = table.Column<string>(type: "TEXT", nullable: true),
TitleUnicode = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID); table.PrimaryKey("PK_BeatmapMetadata", x => x.ID);
table.ForeignKey( table.ForeignKey(
name: "FK_BeatmapSetInfo_BeatmapMetadata_MetadataID", name: "FK_BeatmapMetadata_BeatmapSetInfo_BeatmapSetInfoId",
column: x => x.MetadataID, column: x => x.BeatmapSetInfoId,
principalTable: "BeatmapMetadata",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "BeatmapInfo",
columns: table => new
{
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),
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),
Path = table.Column<string>(type: "TEXT", nullable: true),
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),
StoredBookmarks = table.Column<string>(type: "TEXT", nullable: true),
TimelineZoom = table.Column<double>(type: "REAL", nullable: false),
Version = table.Column<string>(type: "TEXT", nullable: true),
WidescreenStoryboard = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapInfo", x => x.ID);
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(
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",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BeatmapInfo_RulesetInfo_RulesetID",
column: x => x.RulesetID,
principalTable: "RulesetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -201,16 +122,93 @@ namespace osu.Game.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "BeatmapInfo",
columns: table => new
{
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),
BeatmapSetInfoID = table.Column<int>(type: "INTEGER", nullable: false),
Countdown = table.Column<bool>(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),
Path = table.Column<string>(type: "TEXT", nullable: true),
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),
StoredBookmarks = table.Column<string>(type: "TEXT", nullable: true),
TimelineZoom = table.Column<double>(type: "REAL", nullable: false),
Version = table.Column<string>(type: "TEXT", nullable: true),
WidescreenStoryboard = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapInfo", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapSetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapMetadata_MetadataID",
column: x => x.MetadataID,
principalTable: "BeatmapMetadata",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BeatmapInfo_RulesetInfo_RulesetID",
column: x => x.RulesetID,
principalTable: "RulesetInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BeatmapDifficulty",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ApproachRate = table.Column<float>(type: "REAL", nullable: false),
BeatmapInfoId = table.Column<int>(type: "INTEGER", nullable: false),
CircleSize = table.Column<float>(type: "REAL", nullable: false),
DrainRate = table.Column<float>(type: "REAL", nullable: false),
OverallDifficulty = table.Column<float>(type: "REAL", nullable: false),
SliderMultiplier = table.Column<float>(type: "REAL", nullable: false),
SliderTickRate = table.Column<float>(type: "REAL", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapDifficulty", x => x.ID);
table.ForeignKey(
name: "FK_BeatmapDifficulty_BeatmapInfo_BeatmapInfoId",
column: x => x.BeatmapInfoId,
principalTable: "BeatmapInfo",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_BeatmapDifficulty_BeatmapInfoId",
table: "BeatmapDifficulty",
column: "BeatmapInfoId",
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_BeatmapSetInfoID", name: "IX_BeatmapInfo_BeatmapSetInfoID",
table: "BeatmapInfo", table: "BeatmapInfo",
column: "BeatmapSetInfoID"); column: "BeatmapSetInfoID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_DifficultyID",
table: "BeatmapInfo",
column: "DifficultyID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_MD5Hash", name: "IX_BeatmapInfo_MD5Hash",
table: "BeatmapInfo", table: "BeatmapInfo",
@ -226,6 +224,12 @@ namespace osu.Game.Migrations
table: "BeatmapInfo", table: "BeatmapInfo",
column: "RulesetID"); column: "RulesetID");
migrationBuilder.CreateIndex(
name: "IX_BeatmapMetadata_BeatmapSetInfoId",
table: "BeatmapMetadata",
column: "BeatmapSetInfoId",
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID", name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID",
table: "BeatmapSetFileInfo", table: "BeatmapSetFileInfo",
@ -241,11 +245,6 @@ namespace osu.Game.Migrations
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",
@ -288,7 +287,7 @@ namespace osu.Game.Migrations
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapInfo"); name: "BeatmapDifficulty");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapSetFileInfo"); name: "BeatmapSetFileInfo");
@ -297,19 +296,19 @@ namespace osu.Game.Migrations
name: "KeyBinding"); name: "KeyBinding");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapDifficulty"); name: "BeatmapInfo");
migrationBuilder.DropTable(
name: "RulesetInfo");
migrationBuilder.DropTable(
name: "BeatmapSetInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "FileInfo"); name: "FileInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapMetadata"); name: "BeatmapMetadata");
migrationBuilder.DropTable(
name: "RulesetInfo");
migrationBuilder.DropTable(
name: "BeatmapSetInfo");
} }
} }
} }

View File

@ -1,7 +1,4 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // <auto-generated />
// 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 osu.Game.Database; using osu.Game.Database;
@ -24,6 +21,8 @@ namespace osu.Game.Migrations
b.Property<float>("ApproachRate"); b.Property<float>("ApproachRate");
b.Property<int>("BeatmapInfoId");
b.Property<float>("CircleSize"); b.Property<float>("CircleSize");
b.Property<float>("DrainRate"); b.Property<float>("DrainRate");
@ -36,6 +35,9 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapInfoId")
.IsUnique();
b.ToTable("BeatmapDifficulty"); b.ToTable("BeatmapDifficulty");
}); });
@ -54,8 +56,6 @@ namespace osu.Game.Migrations
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");
@ -92,8 +92,6 @@ namespace osu.Game.Migrations
b.HasIndex("BeatmapSetInfoID"); b.HasIndex("BeatmapSetInfoID");
b.HasIndex("DifficultyID");
b.HasIndex("MD5Hash"); b.HasIndex("MD5Hash");
b.HasIndex("MetadataID"); b.HasIndex("MetadataID");
@ -114,10 +112,13 @@ namespace osu.Game.Migrations
b.Property<string>("AudioFile"); b.Property<string>("AudioFile");
b.Property<string>("Author"); b.Property<string>("AuthorString")
.HasColumnName("Author");
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,6 +131,9 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId")
.IsUnique();
b.ToTable("BeatmapMetadata"); b.ToTable("BeatmapMetadata");
}); });
@ -163,16 +167,12 @@ namespace osu.Game.Migrations
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");
}); });
@ -243,6 +243,14 @@ namespace osu.Game.Migrations
b.ToTable("RulesetInfo"); b.ToTable("RulesetInfo");
}); });
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{
b.HasOne("osu.Game.Beatmaps.BeatmapInfo")
.WithOne("Difficulty")
.HasForeignKey("osu.Game.Beatmaps.BeatmapDifficulty", "BeatmapInfoId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
@ -250,11 +258,6 @@ namespace osu.Game.Migrations
.HasForeignKey("BeatmapSetInfoID") .HasForeignKey("BeatmapSetInfoID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty")
.WithMany()
.HasForeignKey("DifficultyID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata")
.WithMany() .WithMany()
.HasForeignKey("MetadataID"); .HasForeignKey("MetadataID");
@ -265,6 +268,14 @@ namespace osu.Game.Migrations
.OnDelete(DeleteBehavior.Cascade); .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);
});
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
{ {
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
@ -277,13 +288,6 @@ namespace osu.Game.Migrations
.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

@ -23,6 +23,7 @@
<TargetZone>LocalIntranet</TargetZone> <TargetZone>LocalIntranet</TargetZone>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
@ -197,6 +198,10 @@
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.ValueTuple">
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\osu.licenseheader"> <None Include="..\osu.licenseheader">
@ -274,9 +279,9 @@
<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="Database\IPopulate.cs" /> <Compile Include="Database\IPopulate.cs" />
<Compile Include="Migrations\20171014052545_Init.cs" /> <Compile Include="Migrations\20171015101238_Init.cs" />
<Compile Include="Migrations\20171014052545_Init.designer.cs"> <Compile Include="Migrations\20171015101238_Init.designer.cs">
<DependentUpon>20171014052545_Init.cs</DependentUpon> <DependentUpon>20171015101238_Init.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" /> <Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" /> <Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />

View File

@ -49,4 +49,5 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste
<package id="System.Runtime.CompilerServices.Unsafe" version="4.4.0" targetFramework="net461" /> <package id="System.Runtime.CompilerServices.Unsafe" version="4.4.0" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" /> <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Threading" version="4.3.0" targetFramework="net461" /> <package id="System.Threading" version="4.3.0" targetFramework="net461" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
</packages> </packages>