396 lines
20 KiB
C#
396 lines
20 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace Backend.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Seasons",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Year = table.Column<int>(type: "integer", nullable: false),
|
|
Name = table.Column<string>(type: "character varying(160)", maxLength: 160, nullable: false),
|
|
IsCurrent = table.Column<bool>(type: "boolean", nullable: false),
|
|
IsCommunityOnly = table.Column<bool>(type: "boolean", nullable: false),
|
|
CurrentPhase = table.Column<string>(type: "character varying(60)", maxLength: 60, nullable: false),
|
|
NominationStartsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
NominationEndsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
VotingStartsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
VotingEndsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
ReviewStartsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
ReviewEndsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
ShowDate = table.Column<DateOnly>(type: "date", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Seasons", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Categories",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
GroupName = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
Name = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Slug = table.Column<string>(type: "text", nullable: false),
|
|
Description = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
SortOrder = table.Column<int>(type: "integer", nullable: false),
|
|
MaxNomineesPerUser = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Categories", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Categories_Seasons_SeasonId",
|
|
column: x => x.SeasonId,
|
|
principalTable: "Seasons",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "VoteBallots",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
SubmittedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Status = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
|
|
SubmittedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_VoteBallots", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_VoteBallots_Seasons_SeasonId",
|
|
column: x => x.SeasonId,
|
|
principalTable: "Seasons",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Candidates",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryId = table.Column<int>(type: "integer", nullable: false),
|
|
DisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
ChannelSlug = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Platform = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Candidates", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Candidates_Categories_CategoryId",
|
|
column: x => x.CategoryId,
|
|
principalTable: "Categories",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Candidates_Seasons_SeasonId",
|
|
column: x => x.SeasonId,
|
|
principalTable: "Seasons",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Nominations",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryId = table.Column<int>(type: "integer", nullable: false),
|
|
SubmittedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
CandidateId = table.Column<int>(type: "integer", nullable: true),
|
|
CandidateText = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Nominations", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Nominations_Candidates_CandidateId",
|
|
column: x => x.CandidateId,
|
|
principalTable: "Candidates",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_Nominations_Categories_CategoryId",
|
|
column: x => x.CategoryId,
|
|
principalTable: "Categories",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Nominations_Seasons_SeasonId",
|
|
column: x => x.SeasonId,
|
|
principalTable: "Seasons",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Results",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
CandidateId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Results", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Results_Candidates_CandidateId",
|
|
column: x => x.CandidateId,
|
|
principalTable: "Candidates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Results_Seasons_SeasonId",
|
|
column: x => x.SeasonId,
|
|
principalTable: "Seasons",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "VoteEntries",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
BallotId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryId = table.Column<int>(type: "integer", nullable: false),
|
|
CandidateId = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_VoteEntries", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_VoteEntries_Candidates_CandidateId",
|
|
column: x => x.CandidateId,
|
|
principalTable: "Candidates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_VoteEntries_Categories_CategoryId",
|
|
column: x => x.CategoryId,
|
|
principalTable: "Categories",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_VoteEntries_VoteBallots_BallotId",
|
|
column: x => x.BallotId,
|
|
principalTable: "VoteBallots",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Seasons",
|
|
columns: new[] { "Id", "CurrentPhase", "IsCommunityOnly", "IsCurrent", "Name", "NominationEndsAt", "NominationStartsAt", "ReviewEndsAt", "ReviewStartsAt", "ShowDate", "VotingEndsAt", "VotingStartsAt", "Year" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "Community Voting", true, true, "VTuber Star Awards 2026", new DateOnly(2026, 5, 31), new DateOnly(2026, 5, 1), new DateOnly(2026, 7, 10), new DateOnly(2026, 7, 1), new DateOnly(2026, 7, 20), new DateOnly(2026, 6, 30), new DateOnly(2026, 6, 1), 2026 },
|
|
{ 2, "Archived", true, false, "VTuber Star Awards 2025", new DateOnly(2025, 5, 31), new DateOnly(2025, 5, 1), new DateOnly(2025, 7, 10), new DateOnly(2025, 7, 1), new DateOnly(2025, 7, 20), new DateOnly(2025, 6, 30), new DateOnly(2025, 6, 1), 2025 },
|
|
{ 3, "Archived", true, false, "VTuber Star Awards 2024", new DateOnly(2024, 5, 31), new DateOnly(2024, 5, 1), new DateOnly(2024, 7, 10), new DateOnly(2024, 7, 1), new DateOnly(2024, 7, 20), new DateOnly(2024, 6, 30), new DateOnly(2024, 6, 1), 2024 },
|
|
{ 4, "Archived", true, false, "VTuber Star Awards 2023", new DateOnly(2023, 5, 31), new DateOnly(2023, 5, 1), new DateOnly(2023, 7, 10), new DateOnly(2023, 7, 1), new DateOnly(2023, 7, 20), new DateOnly(2023, 6, 30), new DateOnly(2023, 6, 1), 2023 }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Categories",
|
|
columns: new[] { "Id", "Description", "GroupName", "MaxNomineesPerUser", "Name", "SeasonId", "Slug", "SortOrder" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "Die groesste Auszeichnung des Jahres.", "Main Awards", 3, "VTuber des Jahres", 1, "vtuber-des-jahres", 1 },
|
|
{ 2, "Events, Konzerte und 3D-Shows.", "Performance", 3, "Bestes Live Event", 1, "bestes-live-event", 2 },
|
|
{ 3, "Der lustigste oder emotionalste Clip des Jahres.", "Clips & Highlights", 3, "Clip des Jahres", 1, "clip-des-jahres", 3 },
|
|
{ 4, "Die aktivste und freundlichste Community.", "Main Awards", 3, "Beste Community", 1, "beste-community", 4 },
|
|
{ 5, "Archivkategorie 2025.", "Main Awards", 3, "VTuber des Jahres", 2, "vtuber-des-jahres", 1 },
|
|
{ 6, "Archivkategorie 2025.", "Performance", 3, "Bestes Live Event", 2, "bestes-live-event", 2 },
|
|
{ 7, "Archivkategorie 2025.", "Clips & Highlights", 3, "Clip des Jahres", 2, "clip-des-jahres", 3 },
|
|
{ 8, "Archivkategorie 2024.", "Main Awards", 3, "VTuber des Jahres", 3, "vtuber-des-jahres", 1 },
|
|
{ 9, "Archivkategorie 2024.", "Clips & Highlights", 3, "Clip des Jahres", 3, "clip-des-jahres", 2 },
|
|
{ 10, "Archivkategorie 2023.", "Main Awards", 3, "VTuber des Jahres", 4, "vtuber-des-jahres", 1 }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "VoteBallots",
|
|
columns: new[] { "Id", "SeasonId", "Status", "SubmittedAt", "SubmittedByTwitchId" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, 1, "submitted", new DateTimeOffset(new DateTime(2026, 6, 11, 12, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), "twitch_vote_1" },
|
|
{ 2, 1, "submitted", new DateTimeOffset(new DateTime(2026, 6, 11, 12, 5, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), "twitch_vote_2" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Candidates",
|
|
columns: new[] { "Id", "CategoryId", "ChannelSlug", "DisplayName", "Platform", "SeasonId" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, 1, "@hoshimimiyu", "Hoshimi Miyu", "Twitch", 1 },
|
|
{ 2, 1, "@kurainu", "Kurainu", "Twitch", 1 },
|
|
{ 3, 1, "@shiroch", "Shiro Ch.", "Twitch", 1 },
|
|
{ 4, 2, "@kurainu", "Kurainu 3D Live", "Twitch", 1 },
|
|
{ 5, 2, "@aoisakura", "Aoi Sakura Showcase", "YouTube", 1 },
|
|
{ 6, 3, "@pyonkichikingdom", "Pyonkichi Kingdom", "Twitch", 1 },
|
|
{ 7, 4, "@moonrelay", "Moonrelay", "Twitch", 1 },
|
|
{ 8, 5, "@hoshimimiyu", "Hoshimi Miyu", "Twitch", 2 },
|
|
{ 9, 6, "@kurainu", "Kurainu 3D Live", "Twitch", 2 },
|
|
{ 10, 7, "@pyonkichikingdom", "Pyonkichi Kingdom", "Twitch", 2 },
|
|
{ 11, 8, "@aoisakura", "Aoi Sakura", "YouTube", 3 },
|
|
{ 12, 9, "@starbyte", "Starbyte", "Twitch", 3 },
|
|
{ 13, 10, "@tenshivox", "Tenshi Vox", "Twitch", 4 }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Nominations",
|
|
columns: new[] { "Id", "CandidateId", "CandidateText", "CategoryId", "CreatedAt", "SeasonId", "SubmittedByTwitchId" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, null, "Hoshimi Miyu", 1, new DateTimeOffset(new DateTime(2026, 6, 10, 13, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), 1, "twitch_hoshi" },
|
|
{ 2, null, "Kurainu 3D Live", 2, new DateTimeOffset(new DateTime(2026, 6, 10, 14, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), 1, "twitch_kurainu" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Results",
|
|
columns: new[] { "Id", "CandidateId", "CategoryName", "SeasonId" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, 8, "VTuber des Jahres", 2 },
|
|
{ 2, 9, "Bestes Live Event", 2 },
|
|
{ 3, 10, "Clip des Jahres", 2 },
|
|
{ 4, 11, "VTuber des Jahres", 3 },
|
|
{ 5, 12, "Clip des Jahres", 3 },
|
|
{ 6, 13, "VTuber des Jahres", 4 }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "VoteEntries",
|
|
columns: new[] { "Id", "BallotId", "CandidateId", "CategoryId" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, 1, 1, 1 },
|
|
{ 2, 1, 4, 2 },
|
|
{ 3, 2, 2, 1 },
|
|
{ 4, 2, 6, 3 }
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Candidates_CategoryId",
|
|
table: "Candidates",
|
|
column: "CategoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Candidates_SeasonId",
|
|
table: "Candidates",
|
|
column: "SeasonId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Categories_SeasonId_Slug",
|
|
table: "Categories",
|
|
columns: new[] { "SeasonId", "Slug" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_CandidateId",
|
|
table: "Nominations",
|
|
column: "CandidateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_CategoryId",
|
|
table: "Nominations",
|
|
column: "CategoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_SeasonId",
|
|
table: "Nominations",
|
|
column: "SeasonId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Results_CandidateId",
|
|
table: "Results",
|
|
column: "CandidateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Results_SeasonId",
|
|
table: "Results",
|
|
column: "SeasonId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Seasons_Year",
|
|
table: "Seasons",
|
|
column: "Year",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VoteBallots_SeasonId",
|
|
table: "VoteBallots",
|
|
column: "SeasonId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VoteEntries_BallotId",
|
|
table: "VoteEntries",
|
|
column: "BallotId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VoteEntries_CandidateId",
|
|
table: "VoteEntries",
|
|
column: "CandidateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VoteEntries_CategoryId",
|
|
table: "VoteEntries",
|
|
column: "CategoryId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Nominations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Results");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "VoteEntries");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Candidates");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "VoteBallots");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Categories");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Seasons");
|
|
}
|
|
}
|
|
}
|