Use migrations

This commit is contained in:
BtbN
2019-06-13 19:08:53 +02:00
parent 9e24c9a353
commit 65cb1961d9
5 changed files with 1054 additions and 7 deletions

View File

@@ -29,16 +29,18 @@ namespace ClanServer
.HasIndex(card => card.DataId);
var jbScoreEntity = modelBuilder.Entity<JubeatScore>();
jbScoreEntity
.HasIndex(score => score.ProfileID);
jbScoreEntity
.HasIndex(score => new { score.ProfileID, score.MusicID, score.Seq });
jbScoreEntity
.HasIndex(score => new { score.ProfileID, score.MusicID });
jbScoreEntity
.HasIndex(score => new { score.MusicID, score.Seq });
jbScoreEntity
.HasIndex(score => score.ProfileID);
var jbHighScoreEntity = modelBuilder.Entity<JubeatHighscore>();
jbHighScoreEntity
.HasIndex(score => score.ProfileID);
jbHighScoreEntity
.HasIndex(score => new { score.ProfileID, score.MusicID, score.Seq })
.IsUnique();
@@ -46,8 +48,6 @@ namespace ClanServer
.HasIndex(score => new { score.ProfileID, score.MusicID });
jbHighScoreEntity
.HasIndex(score => new { score.MusicID, score.Seq });
jbHighScoreEntity
.HasIndex(score => score.ProfileID);
}
public DbSet<Player> Players { get; set; }

View File

@@ -0,0 +1,356 @@
// <auto-generated />
using System;
using ClanServer;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ClanServer.Migrations
{
[DbContext(typeof(ClanServerContext))]
[Migration("20190613170828_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
modelBuilder.Entity("ClanServer.Models.Card", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CardId")
.IsRequired()
.HasMaxLength(16);
b.Property<string>("DataId")
.IsRequired()
.HasMaxLength(16);
b.Property<int>("PlayerID");
b.Property<string>("RefId")
.IsRequired()
.HasMaxLength(16);
b.HasKey("ID");
b.HasIndex("CardId")
.IsUnique();
b.HasIndex("DataId");
b.HasIndex("PlayerID");
b.HasIndex("RefId")
.IsUnique();
b.ToTable("Cards");
});
modelBuilder.Entity("ClanServer.Models.JubeatClanJubility", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<bool>("IsHardMode");
b.Property<int>("MusicID");
b.Property<int>("ProfileID");
b.Property<int>("Score");
b.Property<sbyte>("Seq");
b.Property<int>("Value");
b.HasKey("ID");
b.HasIndex("ProfileID");
b.ToTable("JubeatClanJubility");
});
modelBuilder.Entity("ClanServer.Models.JubeatClanProfileData", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("BeatCount");
b.Property<bool>("BonusTunePlayed");
b.Property<int>("BonusTunePoints");
b.Property<int>("ClearCount");
b.Property<int>("ExCount");
b.Property<int>("FcCount");
b.Property<short>("HouseNo1");
b.Property<short>("HouseNo2");
b.Property<int>("JboxPoints");
b.Property<int>("JubilityParam");
b.Property<int>("MatchCount");
b.Property<int>("PlayTime");
b.Property<int>("ProfileID");
b.Property<int>("SaveCount");
b.Property<int>("SavedCount");
b.Property<int>("Section");
b.Property<int>("Street");
b.Property<byte>("Team");
b.Property<int>("TuneCount");
b.HasKey("ID");
b.HasIndex("ProfileID")
.IsUnique();
b.ToTable("JubeatClanProfileData");
});
modelBuilder.Entity("ClanServer.Models.JubeatClanSettings", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<sbyte>("Category");
b.Property<sbyte>("ComboDisplay");
b.Property<short>("EmblemBackground");
b.Property<short>("EmblemBalloon");
b.Property<short>("EmblemEffect");
b.Property<short>("EmblemMain");
b.Property<short>("EmblemOrnament");
b.Property<sbyte>("ExpertOption");
b.Property<sbyte>("Hard");
b.Property<sbyte>("Hazard");
b.Property<sbyte>("Marker");
b.Property<sbyte>("Matching");
b.Property<short>("Parts");
b.Property<int>("ProfileID");
b.Property<sbyte>("RankSort");
b.Property<sbyte>("Sort");
b.Property<sbyte>("Theme");
b.Property<short>("Title");
b.HasKey("ID");
b.HasIndex("ProfileID")
.IsUnique();
b.ToTable("JubeatClanSettings");
});
modelBuilder.Entity("ClanServer.Models.JubeatHighscore", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<byte[]>("Bar")
.HasMaxLength(30);
b.Property<sbyte>("Clear");
b.Property<int>("ClearCount");
b.Property<int>("ExcCount");
b.Property<int>("FcCount");
b.Property<int>("MusicID");
b.Property<int>("PlayCount");
b.Property<int>("ProfileID");
b.Property<int>("Score");
b.Property<sbyte>("Seq");
b.Property<long>("Timestamp");
b.HasKey("ID");
b.HasIndex("ProfileID");
b.HasIndex("MusicID", "Seq");
b.HasIndex("ProfileID", "MusicID");
b.HasIndex("ProfileID", "MusicID", "Seq")
.IsUnique();
b.ToTable("JubeatHighscores");
});
modelBuilder.Entity("ClanServer.Models.JubeatProfile", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.Property<int>("PlayerID");
b.HasKey("ID");
b.HasIndex("PlayerID")
.IsUnique();
b.ToTable("JubeatProfiles");
});
modelBuilder.Entity("ClanServer.Models.JubeatScore", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<byte[]>("Bar")
.HasMaxLength(30);
b.Property<sbyte>("Clear");
b.Property<bool>("IsHardMode");
b.Property<bool>("IsHazardMode");
b.Property<int>("MusicID");
b.Property<short>("NumGood");
b.Property<short>("NumGreat");
b.Property<short>("NumMiss");
b.Property<short>("NumPerfect");
b.Property<short>("NumPoor");
b.Property<int>("ProfileID");
b.Property<int>("Score");
b.Property<sbyte>("Seq");
b.Property<long>("Timestamp");
b.HasKey("ID");
b.HasIndex("ProfileID");
b.HasIndex("MusicID", "Seq");
b.HasIndex("ProfileID", "MusicID");
b.HasIndex("ProfileID", "MusicID", "Seq");
b.ToTable("JubeatScores");
});
modelBuilder.Entity("ClanServer.Models.Player", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Passwd");
b.HasKey("ID");
b.ToTable("Players");
});
modelBuilder.Entity("ClanServer.Models.Card", b =>
{
b.HasOne("ClanServer.Models.Player", "Player")
.WithMany("Cards")
.HasForeignKey("PlayerID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatClanJubility", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithMany("Jubilitys")
.HasForeignKey("ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatClanProfileData", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithOne("ClanData")
.HasForeignKey("ClanServer.Models.JubeatClanProfileData", "ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatClanSettings", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithOne("ClanSettings")
.HasForeignKey("ClanServer.Models.JubeatClanSettings", "ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatHighscore", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithMany("Highscores")
.HasForeignKey("ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatProfile", b =>
{
b.HasOne("ClanServer.Models.Player", "Player")
.WithOne("JubeatProfile")
.HasForeignKey("ClanServer.Models.JubeatProfile", "PlayerID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatScore", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithMany("Scores")
.HasForeignKey("ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,337 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ClanServer.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Players",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Passwd = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Players", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Cards",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PlayerID = table.Column<int>(nullable: false),
CardId = table.Column<string>(maxLength: 16, nullable: false),
DataId = table.Column<string>(maxLength: 16, nullable: false),
RefId = table.Column<string>(maxLength: 16, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Cards", x => x.ID);
table.ForeignKey(
name: "FK_Cards_Players_PlayerID",
column: x => x.PlayerID,
principalTable: "Players",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "JubeatProfiles",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PlayerID = table.Column<int>(nullable: false),
Name = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JubeatProfiles", x => x.ID);
table.ForeignKey(
name: "FK_JubeatProfiles_Players_PlayerID",
column: x => x.PlayerID,
principalTable: "Players",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "JubeatClanJubility",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProfileID = table.Column<int>(nullable: false),
MusicID = table.Column<int>(nullable: false),
Seq = table.Column<sbyte>(nullable: false),
Score = table.Column<int>(nullable: false),
Value = table.Column<int>(nullable: false),
IsHardMode = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JubeatClanJubility", x => x.ID);
table.ForeignKey(
name: "FK_JubeatClanJubility_JubeatProfiles_ProfileID",
column: x => x.ProfileID,
principalTable: "JubeatProfiles",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "JubeatClanProfileData",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProfileID = table.Column<int>(nullable: false),
Team = table.Column<byte>(nullable: false),
Street = table.Column<int>(nullable: false),
Section = table.Column<int>(nullable: false),
HouseNo1 = table.Column<short>(nullable: false),
HouseNo2 = table.Column<short>(nullable: false),
PlayTime = table.Column<int>(nullable: false),
TuneCount = table.Column<int>(nullable: false),
ClearCount = table.Column<int>(nullable: false),
FcCount = table.Column<int>(nullable: false),
ExCount = table.Column<int>(nullable: false),
MatchCount = table.Column<int>(nullable: false),
BeatCount = table.Column<int>(nullable: false),
SaveCount = table.Column<int>(nullable: false),
SavedCount = table.Column<int>(nullable: false),
BonusTunePoints = table.Column<int>(nullable: false),
BonusTunePlayed = table.Column<bool>(nullable: false),
JubilityParam = table.Column<int>(nullable: false),
JboxPoints = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JubeatClanProfileData", x => x.ID);
table.ForeignKey(
name: "FK_JubeatClanProfileData_JubeatProfiles_ProfileID",
column: x => x.ProfileID,
principalTable: "JubeatProfiles",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "JubeatClanSettings",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProfileID = table.Column<int>(nullable: false),
ExpertOption = table.Column<sbyte>(nullable: false),
Sort = table.Column<sbyte>(nullable: false),
Category = table.Column<sbyte>(nullable: false),
Marker = table.Column<sbyte>(nullable: false),
Theme = table.Column<sbyte>(nullable: false),
RankSort = table.Column<sbyte>(nullable: false),
ComboDisplay = table.Column<sbyte>(nullable: false),
Matching = table.Column<sbyte>(nullable: false),
Hard = table.Column<sbyte>(nullable: false),
Hazard = table.Column<sbyte>(nullable: false),
Title = table.Column<short>(nullable: false),
Parts = table.Column<short>(nullable: false),
EmblemBackground = table.Column<short>(nullable: false),
EmblemMain = table.Column<short>(nullable: false),
EmblemOrnament = table.Column<short>(nullable: false),
EmblemEffect = table.Column<short>(nullable: false),
EmblemBalloon = table.Column<short>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JubeatClanSettings", x => x.ID);
table.ForeignKey(
name: "FK_JubeatClanSettings_JubeatProfiles_ProfileID",
column: x => x.ProfileID,
principalTable: "JubeatProfiles",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "JubeatHighscores",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProfileID = table.Column<int>(nullable: false),
Timestamp = table.Column<long>(nullable: false),
MusicID = table.Column<int>(nullable: false),
Seq = table.Column<sbyte>(nullable: false),
Score = table.Column<int>(nullable: false),
Clear = table.Column<sbyte>(nullable: false),
PlayCount = table.Column<int>(nullable: false),
ClearCount = table.Column<int>(nullable: false),
FcCount = table.Column<int>(nullable: false),
ExcCount = table.Column<int>(nullable: false),
Bar = table.Column<byte[]>(maxLength: 30, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_JubeatHighscores", x => x.ID);
table.ForeignKey(
name: "FK_JubeatHighscores_JubeatProfiles_ProfileID",
column: x => x.ProfileID,
principalTable: "JubeatProfiles",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "JubeatScores",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProfileID = table.Column<int>(nullable: false),
Timestamp = table.Column<long>(nullable: false),
MusicID = table.Column<int>(nullable: false),
Seq = table.Column<sbyte>(nullable: false),
Score = table.Column<int>(nullable: false),
Clear = table.Column<sbyte>(nullable: false),
NumPerfect = table.Column<short>(nullable: false),
NumGreat = table.Column<short>(nullable: false),
NumGood = table.Column<short>(nullable: false),
NumPoor = table.Column<short>(nullable: false),
NumMiss = table.Column<short>(nullable: false),
IsHardMode = table.Column<bool>(nullable: false),
IsHazardMode = table.Column<bool>(nullable: false),
Bar = table.Column<byte[]>(maxLength: 30, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_JubeatScores", x => x.ID);
table.ForeignKey(
name: "FK_JubeatScores_JubeatProfiles_ProfileID",
column: x => x.ProfileID,
principalTable: "JubeatProfiles",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Cards_CardId",
table: "Cards",
column: "CardId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Cards_DataId",
table: "Cards",
column: "DataId");
migrationBuilder.CreateIndex(
name: "IX_Cards_PlayerID",
table: "Cards",
column: "PlayerID");
migrationBuilder.CreateIndex(
name: "IX_Cards_RefId",
table: "Cards",
column: "RefId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_JubeatClanJubility_ProfileID",
table: "JubeatClanJubility",
column: "ProfileID");
migrationBuilder.CreateIndex(
name: "IX_JubeatClanProfileData_ProfileID",
table: "JubeatClanProfileData",
column: "ProfileID",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_JubeatClanSettings_ProfileID",
table: "JubeatClanSettings",
column: "ProfileID",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_JubeatHighscores_ProfileID",
table: "JubeatHighscores",
column: "ProfileID");
migrationBuilder.CreateIndex(
name: "IX_JubeatHighscores_MusicID_Seq",
table: "JubeatHighscores",
columns: new[] { "MusicID", "Seq" });
migrationBuilder.CreateIndex(
name: "IX_JubeatHighscores_ProfileID_MusicID",
table: "JubeatHighscores",
columns: new[] { "ProfileID", "MusicID" });
migrationBuilder.CreateIndex(
name: "IX_JubeatHighscores_ProfileID_MusicID_Seq",
table: "JubeatHighscores",
columns: new[] { "ProfileID", "MusicID", "Seq" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_JubeatProfiles_PlayerID",
table: "JubeatProfiles",
column: "PlayerID",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_JubeatScores_ProfileID",
table: "JubeatScores",
column: "ProfileID");
migrationBuilder.CreateIndex(
name: "IX_JubeatScores_MusicID_Seq",
table: "JubeatScores",
columns: new[] { "MusicID", "Seq" });
migrationBuilder.CreateIndex(
name: "IX_JubeatScores_ProfileID_MusicID",
table: "JubeatScores",
columns: new[] { "ProfileID", "MusicID" });
migrationBuilder.CreateIndex(
name: "IX_JubeatScores_ProfileID_MusicID_Seq",
table: "JubeatScores",
columns: new[] { "ProfileID", "MusicID", "Seq" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Cards");
migrationBuilder.DropTable(
name: "JubeatClanJubility");
migrationBuilder.DropTable(
name: "JubeatClanProfileData");
migrationBuilder.DropTable(
name: "JubeatClanSettings");
migrationBuilder.DropTable(
name: "JubeatHighscores");
migrationBuilder.DropTable(
name: "JubeatScores");
migrationBuilder.DropTable(
name: "JubeatProfiles");
migrationBuilder.DropTable(
name: "Players");
}
}
}

View File

@@ -0,0 +1,354 @@
// <auto-generated />
using System;
using ClanServer;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ClanServer.Migrations
{
[DbContext(typeof(ClanServerContext))]
partial class ClanServerContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
modelBuilder.Entity("ClanServer.Models.Card", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CardId")
.IsRequired()
.HasMaxLength(16);
b.Property<string>("DataId")
.IsRequired()
.HasMaxLength(16);
b.Property<int>("PlayerID");
b.Property<string>("RefId")
.IsRequired()
.HasMaxLength(16);
b.HasKey("ID");
b.HasIndex("CardId")
.IsUnique();
b.HasIndex("DataId");
b.HasIndex("PlayerID");
b.HasIndex("RefId")
.IsUnique();
b.ToTable("Cards");
});
modelBuilder.Entity("ClanServer.Models.JubeatClanJubility", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<bool>("IsHardMode");
b.Property<int>("MusicID");
b.Property<int>("ProfileID");
b.Property<int>("Score");
b.Property<sbyte>("Seq");
b.Property<int>("Value");
b.HasKey("ID");
b.HasIndex("ProfileID");
b.ToTable("JubeatClanJubility");
});
modelBuilder.Entity("ClanServer.Models.JubeatClanProfileData", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("BeatCount");
b.Property<bool>("BonusTunePlayed");
b.Property<int>("BonusTunePoints");
b.Property<int>("ClearCount");
b.Property<int>("ExCount");
b.Property<int>("FcCount");
b.Property<short>("HouseNo1");
b.Property<short>("HouseNo2");
b.Property<int>("JboxPoints");
b.Property<int>("JubilityParam");
b.Property<int>("MatchCount");
b.Property<int>("PlayTime");
b.Property<int>("ProfileID");
b.Property<int>("SaveCount");
b.Property<int>("SavedCount");
b.Property<int>("Section");
b.Property<int>("Street");
b.Property<byte>("Team");
b.Property<int>("TuneCount");
b.HasKey("ID");
b.HasIndex("ProfileID")
.IsUnique();
b.ToTable("JubeatClanProfileData");
});
modelBuilder.Entity("ClanServer.Models.JubeatClanSettings", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<sbyte>("Category");
b.Property<sbyte>("ComboDisplay");
b.Property<short>("EmblemBackground");
b.Property<short>("EmblemBalloon");
b.Property<short>("EmblemEffect");
b.Property<short>("EmblemMain");
b.Property<short>("EmblemOrnament");
b.Property<sbyte>("ExpertOption");
b.Property<sbyte>("Hard");
b.Property<sbyte>("Hazard");
b.Property<sbyte>("Marker");
b.Property<sbyte>("Matching");
b.Property<short>("Parts");
b.Property<int>("ProfileID");
b.Property<sbyte>("RankSort");
b.Property<sbyte>("Sort");
b.Property<sbyte>("Theme");
b.Property<short>("Title");
b.HasKey("ID");
b.HasIndex("ProfileID")
.IsUnique();
b.ToTable("JubeatClanSettings");
});
modelBuilder.Entity("ClanServer.Models.JubeatHighscore", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<byte[]>("Bar")
.HasMaxLength(30);
b.Property<sbyte>("Clear");
b.Property<int>("ClearCount");
b.Property<int>("ExcCount");
b.Property<int>("FcCount");
b.Property<int>("MusicID");
b.Property<int>("PlayCount");
b.Property<int>("ProfileID");
b.Property<int>("Score");
b.Property<sbyte>("Seq");
b.Property<long>("Timestamp");
b.HasKey("ID");
b.HasIndex("ProfileID");
b.HasIndex("MusicID", "Seq");
b.HasIndex("ProfileID", "MusicID");
b.HasIndex("ProfileID", "MusicID", "Seq")
.IsUnique();
b.ToTable("JubeatHighscores");
});
modelBuilder.Entity("ClanServer.Models.JubeatProfile", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.Property<int>("PlayerID");
b.HasKey("ID");
b.HasIndex("PlayerID")
.IsUnique();
b.ToTable("JubeatProfiles");
});
modelBuilder.Entity("ClanServer.Models.JubeatScore", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<byte[]>("Bar")
.HasMaxLength(30);
b.Property<sbyte>("Clear");
b.Property<bool>("IsHardMode");
b.Property<bool>("IsHazardMode");
b.Property<int>("MusicID");
b.Property<short>("NumGood");
b.Property<short>("NumGreat");
b.Property<short>("NumMiss");
b.Property<short>("NumPerfect");
b.Property<short>("NumPoor");
b.Property<int>("ProfileID");
b.Property<int>("Score");
b.Property<sbyte>("Seq");
b.Property<long>("Timestamp");
b.HasKey("ID");
b.HasIndex("ProfileID");
b.HasIndex("MusicID", "Seq");
b.HasIndex("ProfileID", "MusicID");
b.HasIndex("ProfileID", "MusicID", "Seq");
b.ToTable("JubeatScores");
});
modelBuilder.Entity("ClanServer.Models.Player", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Passwd");
b.HasKey("ID");
b.ToTable("Players");
});
modelBuilder.Entity("ClanServer.Models.Card", b =>
{
b.HasOne("ClanServer.Models.Player", "Player")
.WithMany("Cards")
.HasForeignKey("PlayerID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatClanJubility", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithMany("Jubilitys")
.HasForeignKey("ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatClanProfileData", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithOne("ClanData")
.HasForeignKey("ClanServer.Models.JubeatClanProfileData", "ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatClanSettings", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithOne("ClanSettings")
.HasForeignKey("ClanServer.Models.JubeatClanSettings", "ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatHighscore", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithMany("Highscores")
.HasForeignKey("ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatProfile", b =>
{
b.HasOne("ClanServer.Models.Player", "Player")
.WithOne("JubeatProfile")
.HasForeignKey("ClanServer.Models.JubeatProfile", "PlayerID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ClanServer.Models.JubeatScore", b =>
{
b.HasOne("ClanServer.Models.JubeatProfile", "Profile")
.WithMany("Scores")
.HasForeignKey("ProfileID")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -60,9 +60,9 @@ namespace ClanServer
public void Configure(IApplicationBuilder app)
{
using (var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope())
using (var context = serviceScope.ServiceProvider.GetRequiredService<ClanServerContext>())
{
var context = serviceScope.ServiceProvider.GetRequiredService<ClanServerContext>();
context.Database.EnsureCreated();
context.Database.Migrate();
}
app.Use(async (context, next) =>