1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 13:07:18 +08:00

Revert "Fix removal of FileInfo, BeatmapMetadata, BeatmapDifficulty objects"

This commit is contained in:
Dean Herbert 2017-10-16 12:55:36 +09:00
parent 56e8c7303c
commit 04e5f764a3
7 changed files with 168 additions and 186 deletions

View File

@ -14,7 +14,6 @@ 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,7 +15,6 @@ 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,11 +73,6 @@ 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

@ -10,18 +10,43 @@ namespace osu.Game.Migrations
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapSetInfo", 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),
DeletePending = table.Column<bool>(type: "INTEGER", nullable: false), ApproachRate = table.Column<float>(type: "REAL", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true), CircleSize = table.Column<float>(type: "REAL", nullable: false),
Protected = table.Column<bool>(type: "INTEGER", 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 => constraints: table =>
{ {
table.PrimaryKey("PK_BeatmapSetInfo", 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)
.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(
@ -70,32 +95,83 @@ namespace osu.Game.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "BeatmapMetadata", 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),
Artist = table.Column<string>(type: "TEXT", nullable: true), DeletePending = table.Column<bool>(type: "INTEGER", nullable: false),
ArtistUnicode = table.Column<string>(type: "TEXT", nullable: true), Hash = table.Column<string>(type: "TEXT", nullable: true),
AudioFile = table.Column<string>(type: "TEXT", nullable: true), MetadataID = table.Column<int>(type: "INTEGER", nullable: true),
Author = table.Column<string>(type: "TEXT", nullable: true), Protected = table.Column<bool>(type: "INTEGER", nullable: false)
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_BeatmapMetadata", x => x.ID); table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID);
table.ForeignKey( table.ForeignKey(
name: "FK_BeatmapMetadata_BeatmapSetInfo_BeatmapSetInfoId", name: "FK_BeatmapSetInfo_BeatmapMetadata_MetadataID",
column: x => x.BeatmapSetInfoId, 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)
.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(
@ -125,93 +201,16 @@ 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",
@ -227,12 +226,6 @@ 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",
@ -248,6 +241,11 @@ 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",
@ -290,7 +288,7 @@ namespace osu.Game.Migrations
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapDifficulty"); name: "BeatmapInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapSetFileInfo"); name: "BeatmapSetFileInfo");
@ -299,19 +297,19 @@ namespace osu.Game.Migrations
name: "KeyBinding"); name: "KeyBinding");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapInfo"); name: "BeatmapDifficulty");
migrationBuilder.DropTable(
name: "FileInfo");
migrationBuilder.DropTable(
name: "BeatmapMetadata");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "RulesetInfo"); name: "RulesetInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "BeatmapSetInfo"); name: "BeatmapSetInfo");
migrationBuilder.DropTable(
name: "FileInfo");
migrationBuilder.DropTable(
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("20171015101238_Init")] [Migration("20171014052545_Init")]
partial class Init partial class Init
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -26,8 +29,6 @@ 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");
@ -40,9 +41,6 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapInfoId")
.IsUnique();
b.ToTable("BeatmapDifficulty"); b.ToTable("BeatmapDifficulty");
}); });
@ -61,6 +59,8 @@ 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,6 +97,8 @@ 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");
@ -117,13 +119,10 @@ namespace osu.Game.Migrations
b.Property<string>("AudioFile"); b.Property<string>("AudioFile");
b.Property<string>("AuthorString") b.Property<string>("Author");
.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");
@ -136,9 +135,6 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId")
.IsUnique();
b.ToTable("BeatmapMetadata"); b.ToTable("BeatmapMetadata");
}); });
@ -172,12 +168,16 @@ 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,14 +248,6 @@ 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")
@ -263,6 +255,11 @@ 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");
@ -273,14 +270,6 @@ 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")
@ -293,6 +282,13 @@ 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,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 osu.Game.Database; using osu.Game.Database;
@ -21,8 +24,6 @@ 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");
@ -35,9 +36,6 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapInfoId")
.IsUnique();
b.ToTable("BeatmapDifficulty"); b.ToTable("BeatmapDifficulty");
}); });
@ -56,6 +54,8 @@ 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,6 +92,8 @@ 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");
@ -112,13 +114,10 @@ namespace osu.Game.Migrations
b.Property<string>("AudioFile"); b.Property<string>("AudioFile");
b.Property<string>("AuthorString") b.Property<string>("Author");
.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");
@ -131,9 +130,6 @@ namespace osu.Game.Migrations
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("BeatmapSetInfoId")
.IsUnique();
b.ToTable("BeatmapMetadata"); b.ToTable("BeatmapMetadata");
}); });
@ -167,12 +163,16 @@ 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,14 +243,6 @@ 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")
@ -258,6 +250,11 @@ 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");
@ -268,14 +265,6 @@ 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")
@ -288,6 +277,13 @@ 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,7 +23,6 @@
<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>
@ -279,9 +278,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\20171015101238_Init.cs" /> <Compile Include="Migrations\20171014052545_Init.cs" />
<Compile Include="Migrations\20171015101238_Init.designer.cs"> <Compile Include="Migrations\20171014052545_Init.designer.cs">
<DependentUpon>20171015101238_Init.cs</DependentUpon> <DependentUpon>20171014052545_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" />