mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 07:22:54 +08:00
Fix cascade deletions
This commit is contained in:
parent
12639c6819
commit
b9d0fb96ed
@ -14,6 +14,9 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int BeatmapInfoID { get; set; }
|
||||
|
||||
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
|
||||
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;
|
||||
public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY;
|
||||
|
@ -31,6 +31,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
[Required]
|
||||
public BeatmapSetInfo BeatmapSet { get; set; }
|
||||
|
||||
public BeatmapMetadata Metadata { get; set; }
|
||||
|
||||
public int BaseDifficultyID { get; set; }
|
||||
|
@ -16,6 +16,14 @@ namespace osu.Game.Beatmaps
|
||||
[NotMapped]
|
||||
public int? OnlineBeatmapSetID { get; set; }
|
||||
|
||||
public int? BeatmapSetInfoID { get; set; }
|
||||
|
||||
public BeatmapSetInfo BeatmapSetInfo { get; set; }
|
||||
|
||||
public int? BeatmapInfoID { get; set; }
|
||||
|
||||
public BeatmapInfo BeatmapInfo { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
public string TitleUnicode { get; set; }
|
||||
public string Artist { get; set; }
|
||||
|
@ -74,6 +74,9 @@ namespace osu.Game.Database
|
||||
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.Name).IsUnique();
|
||||
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.InstantiationInfo).IsUnique();
|
||||
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.Available);
|
||||
|
||||
modelBuilder.Entity<BeatmapMetadata>().HasOne(m => m.BeatmapSetInfo).WithOne(s => s.Metadata).OnDelete(DeleteBehavior.Cascade);
|
||||
modelBuilder.Entity<BeatmapMetadata>().HasOne(m => m.BeatmapInfo).WithOne(b => b.Metadata).OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
|
||||
private class OsuDbLoggerFactory : ILoggerFactory
|
||||
|
@ -1,7 +1,4 @@
|
||||
// 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 />
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
@ -13,8 +10,8 @@ using System;
|
||||
namespace osu.Game.Migrations
|
||||
{
|
||||
[DbContext(typeof(OsuDbContext))]
|
||||
[Migration("20171014052545_Init")]
|
||||
partial class Init
|
||||
[Migration("20171017092037_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -29,6 +26,8 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<float>("ApproachRate");
|
||||
|
||||
b.Property<int>("BeatmapInfoID");
|
||||
|
||||
b.Property<float>("CircleSize");
|
||||
|
||||
b.Property<float>("DrainRate");
|
||||
@ -41,6 +40,9 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("BeatmapInfoID")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("BeatmapDifficulty");
|
||||
});
|
||||
|
||||
@ -59,8 +61,6 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<bool>("Countdown");
|
||||
|
||||
b.Property<int>("DifficultyID");
|
||||
|
||||
b.Property<double>("DistanceSpacing");
|
||||
|
||||
b.Property<int>("GridSize");
|
||||
@ -73,8 +73,6 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<string>("MD5Hash");
|
||||
|
||||
b.Property<int?>("MetadataID");
|
||||
|
||||
b.Property<string>("Path");
|
||||
|
||||
b.Property<int>("RulesetID");
|
||||
@ -97,12 +95,8 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.HasIndex("BeatmapSetInfoID");
|
||||
|
||||
b.HasIndex("DifficultyID");
|
||||
|
||||
b.HasIndex("MD5Hash");
|
||||
|
||||
b.HasIndex("MetadataID");
|
||||
|
||||
b.HasIndex("RulesetID");
|
||||
|
||||
b.ToTable("BeatmapInfo");
|
||||
@ -119,10 +113,15 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<string>("AudioFile");
|
||||
|
||||
b.Property<string>("Author");
|
||||
b.Property<string>("AuthorString")
|
||||
.HasColumnName("Author");
|
||||
|
||||
b.Property<string>("BackgroundFile");
|
||||
|
||||
b.Property<int?>("BeatmapInfoID");
|
||||
|
||||
b.Property<int?>("BeatmapSetInfoID");
|
||||
|
||||
b.Property<int>("PreviewTime");
|
||||
|
||||
b.Property<string>("Source");
|
||||
@ -135,6 +134,12 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("BeatmapInfoID")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("BeatmapSetInfoID")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("BeatmapMetadata");
|
||||
});
|
||||
|
||||
@ -168,16 +173,12 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<string>("Hash");
|
||||
|
||||
b.Property<int?>("MetadataID");
|
||||
|
||||
b.Property<bool>("Protected");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("DeletePending");
|
||||
|
||||
b.HasIndex("MetadataID");
|
||||
|
||||
b.ToTable("BeatmapSetInfo");
|
||||
});
|
||||
|
||||
@ -248,6 +249,14 @@ namespace osu.Game.Migrations
|
||||
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 =>
|
||||
{
|
||||
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
|
||||
@ -255,21 +264,25 @@ namespace osu.Game.Migrations
|
||||
.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");
|
||||
|
||||
b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
|
||||
.WithMany()
|
||||
.HasForeignKey("RulesetID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
|
||||
{
|
||||
b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "BeatmapInfo")
|
||||
.WithOne("Metadata")
|
||||
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapInfoID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSetInfo")
|
||||
.WithOne("Metadata")
|
||||
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
|
||||
{
|
||||
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
|
||||
@ -282,13 +295,6 @@ namespace osu.Game.Migrations
|
||||
.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
|
||||
}
|
||||
}
|
@ -1,52 +1,26 @@
|
||||
// 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 Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Migrations
|
||||
{
|
||||
public partial class Init : Migration
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BeatmapDifficulty",
|
||||
name: "BeatmapSetInfo",
|
||||
columns: table => new
|
||||
{
|
||||
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),
|
||||
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)
|
||||
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_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);
|
||||
table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -94,86 +68,6 @@ namespace osu.Game.Migrations
|
||||
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_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)
|
||||
.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",
|
||||
principalColumn: "ID",
|
||||
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(
|
||||
name: "BeatmapSetFileInfo",
|
||||
columns: table => new
|
||||
@ -201,31 +95,144 @@ namespace osu.Game.Migrations
|
||||
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),
|
||||
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_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.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),
|
||||
BeatmapInfoID = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
BeatmapSetInfoID = table.Column<int>(type: "INTEGER", 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);
|
||||
table.ForeignKey(
|
||||
name: "FK_BeatmapMetadata_BeatmapInfo_BeatmapInfoID",
|
||||
column: x => x.BeatmapInfoID,
|
||||
principalTable: "BeatmapInfo",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_BeatmapMetadata_BeatmapSetInfo_BeatmapSetInfoID",
|
||||
column: x => x.BeatmapSetInfoID,
|
||||
principalTable: "BeatmapSetInfo",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapDifficulty_BeatmapInfoID",
|
||||
table: "BeatmapDifficulty",
|
||||
column: "BeatmapInfoID",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapInfo_BeatmapSetInfoID",
|
||||
table: "BeatmapInfo",
|
||||
column: "BeatmapSetInfoID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapInfo_DifficultyID",
|
||||
table: "BeatmapInfo",
|
||||
column: "DifficultyID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapInfo_MD5Hash",
|
||||
table: "BeatmapInfo",
|
||||
column: "MD5Hash");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapInfo_MetadataID",
|
||||
table: "BeatmapInfo",
|
||||
column: "MetadataID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapInfo_RulesetID",
|
||||
table: "BeatmapInfo",
|
||||
column: "RulesetID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapMetadata_BeatmapInfoID",
|
||||
table: "BeatmapMetadata",
|
||||
column: "BeatmapInfoID",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapMetadata_BeatmapSetInfoID",
|
||||
table: "BeatmapMetadata",
|
||||
column: "BeatmapSetInfoID",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID",
|
||||
table: "BeatmapSetFileInfo",
|
||||
@ -241,11 +248,6 @@ namespace osu.Game.Migrations
|
||||
table: "BeatmapSetInfo",
|
||||
column: "DeletePending");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BeatmapSetInfo_MetadataID",
|
||||
table: "BeatmapSetInfo",
|
||||
column: "MetadataID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FileInfo_Hash",
|
||||
table: "FileInfo",
|
||||
@ -288,7 +290,10 @@ namespace osu.Game.Migrations
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "BeatmapInfo");
|
||||
name: "BeatmapDifficulty");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BeatmapMetadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BeatmapSetFileInfo");
|
||||
@ -297,19 +302,16 @@ namespace osu.Game.Migrations
|
||||
name: "KeyBinding");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BeatmapDifficulty");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RulesetInfo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BeatmapSetInfo");
|
||||
name: "BeatmapInfo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "FileInfo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BeatmapMetadata");
|
||||
name: "BeatmapSetInfo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RulesetInfo");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
// 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 />
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using osu.Game.Database;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Migrations
|
||||
{
|
||||
@ -24,6 +25,8 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<float>("ApproachRate");
|
||||
|
||||
b.Property<int>("BeatmapInfoID");
|
||||
|
||||
b.Property<float>("CircleSize");
|
||||
|
||||
b.Property<float>("DrainRate");
|
||||
@ -36,6 +39,9 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("BeatmapInfoID")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("BeatmapDifficulty");
|
||||
});
|
||||
|
||||
@ -54,8 +60,6 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<bool>("Countdown");
|
||||
|
||||
b.Property<int>("DifficultyID");
|
||||
|
||||
b.Property<double>("DistanceSpacing");
|
||||
|
||||
b.Property<int>("GridSize");
|
||||
@ -68,8 +72,6 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<string>("MD5Hash");
|
||||
|
||||
b.Property<int?>("MetadataID");
|
||||
|
||||
b.Property<string>("Path");
|
||||
|
||||
b.Property<int>("RulesetID");
|
||||
@ -92,12 +94,8 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.HasIndex("BeatmapSetInfoID");
|
||||
|
||||
b.HasIndex("DifficultyID");
|
||||
|
||||
b.HasIndex("MD5Hash");
|
||||
|
||||
b.HasIndex("MetadataID");
|
||||
|
||||
b.HasIndex("RulesetID");
|
||||
|
||||
b.ToTable("BeatmapInfo");
|
||||
@ -114,10 +112,15 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<string>("AudioFile");
|
||||
|
||||
b.Property<string>("Author");
|
||||
b.Property<string>("AuthorString")
|
||||
.HasColumnName("Author");
|
||||
|
||||
b.Property<string>("BackgroundFile");
|
||||
|
||||
b.Property<int?>("BeatmapInfoID");
|
||||
|
||||
b.Property<int?>("BeatmapSetInfoID");
|
||||
|
||||
b.Property<int>("PreviewTime");
|
||||
|
||||
b.Property<string>("Source");
|
||||
@ -130,6 +133,12 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("BeatmapInfoID")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("BeatmapSetInfoID")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("BeatmapMetadata");
|
||||
});
|
||||
|
||||
@ -163,16 +172,12 @@ namespace osu.Game.Migrations
|
||||
|
||||
b.Property<string>("Hash");
|
||||
|
||||
b.Property<int?>("MetadataID");
|
||||
|
||||
b.Property<bool>("Protected");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("DeletePending");
|
||||
|
||||
b.HasIndex("MetadataID");
|
||||
|
||||
b.ToTable("BeatmapSetInfo");
|
||||
});
|
||||
|
||||
@ -243,6 +248,14 @@ namespace osu.Game.Migrations
|
||||
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 =>
|
||||
{
|
||||
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet")
|
||||
@ -250,21 +263,25 @@ namespace osu.Game.Migrations
|
||||
.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");
|
||||
|
||||
b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset")
|
||||
.WithMany()
|
||||
.HasForeignKey("RulesetID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b =>
|
||||
{
|
||||
b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "BeatmapInfo")
|
||||
.WithOne("Metadata")
|
||||
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapInfoID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSetInfo")
|
||||
.WithOne("Metadata")
|
||||
.HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b =>
|
||||
{
|
||||
b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo")
|
||||
@ -277,13 +294,6 @@ namespace osu.Game.Migrations
|
||||
.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
|
||||
}
|
||||
}
|
||||
|
@ -286,9 +286,9 @@
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" />
|
||||
<Compile Include="Database\DatabaseContextFactory.cs" />
|
||||
<Compile Include="Migrations\20171014052545_Init.cs" />
|
||||
<Compile Include="Migrations\20171014052545_Init.designer.cs">
|
||||
<DependentUpon>20171014052545_Init.cs</DependentUpon>
|
||||
<Compile Include="Migrations\20171017092037_InitialCreate.cs" />
|
||||
<Compile Include="Migrations\20171017092037_InitialCreate.designer.cs">
|
||||
<DependentUpon>20171017092037_InitialCreate.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
|
||||
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user