Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions ReplayBrowser/Data/Migrations/20241111013501_DbLeaderboards.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace Server.Migrations
{
/// <inheritdoc />
public partial class DbLeaderboards : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "LeaderboardDefinitions",
columns: table => new
{
Name = table.Column<string>(type: "text", nullable: false),
TrackedData = table.Column<string>(type: "text", nullable: false),
ExtraInfo = table.Column<string>(type: "text", nullable: true),
NameColumn = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LeaderboardDefinitions", x => x.Name);
});

migrationBuilder.CreateTable(
name: "Leaderboards",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Servers = table.Column<List<string>>(type: "text[]", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
Position = table.Column<int>(type: "integer", nullable: false),
PlayerGuid = table.Column<Guid>(type: "uuid", nullable: true),
Username = table.Column<string>(type: "text", nullable: false),
LeaderboardDefinitionName = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Leaderboards", x => x.Id);
table.ForeignKey(
name: "FK_Leaderboards_LeaderboardDefinitions_LeaderboardDefinitionNa~",
column: x => x.LeaderboardDefinitionName,
principalTable: "LeaderboardDefinitions",
principalColumn: "Name",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateIndex(
name: "IX_Leaderboards_LeaderboardDefinitionName",
table: "Leaderboards",
column: "LeaderboardDefinitionName");
}

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

migrationBuilder.DropTable(
name: "LeaderboardDefinitions");
}
}
}
Loading