Skip to content

Commit

Permalink
Add score
Browse files Browse the repository at this point in the history
  • Loading branch information
matte-ek committed Nov 6, 2023
1 parent da66cad commit da67152
Show file tree
Hide file tree
Showing 9 changed files with 529 additions and 0 deletions.
2 changes: 2 additions & 0 deletions BanchoMultiplayerBot.Database/BotDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class BotDbContext : DbContext
{
public DbSet<User> Users { get; set; }
public DbSet<Game> Games { get; set; }
public DbSet<Score> Scores { get; set; }

public DbSet<PlayerBan> PlayerBans { get; set; }
public DbSet<MapBan> MapBans { get; set; }

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BanchoMultiplayerBot.Database.Bot.Migrations
{
/// <inheritdoc />
public partial class AddScore : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Scores",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserId = table.Column<int>(type: "INTEGER", nullable: false),
GameId = table.Column<int>(type: "INTEGER", nullable: false),
PlayerId = table.Column<int>(type: "INTEGER", nullable: true),
LobbyId = table.Column<int>(type: "INTEGER", nullable: false),
OsuScoreId = table.Column<long>(type: "INTEGER", nullable: true),
BeatmapId = table.Column<long>(type: "INTEGER", nullable: false),
TotalScore = table.Column<long>(type: "INTEGER", nullable: false),
Rank = table.Column<int>(type: "INTEGER", nullable: false),
MaxCombo = table.Column<int>(type: "INTEGER", nullable: false),
Count300 = table.Column<int>(type: "INTEGER", nullable: false),
Count100 = table.Column<int>(type: "INTEGER", nullable: false),
Count50 = table.Column<int>(type: "INTEGER", nullable: false),
CountMiss = table.Column<int>(type: "INTEGER", nullable: false),
Mods = table.Column<int>(type: "INTEGER", nullable: false),
Time = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Scores", x => x.Id);
table.ForeignKey(
name: "FK_Scores_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Scores_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateIndex(
name: "IX_Scores_GameId",
table: "Scores",
column: "GameId");

migrationBuilder.CreateIndex(
name: "IX_Scores_UserId",
table: "Scores",
column: "UserId");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Scores");
}
}
}
Loading

0 comments on commit da67152

Please sign in to comment.