feat: keep track of user submissions, refs #4

This commit is contained in:
2025-05-24 18:46:29 +02:00
parent fbb6d1a409
commit 5fdd6ec1d0
5 changed files with 278 additions and 2 deletions

View File

@@ -0,0 +1,82 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace song_of_the_day.DataMigrations
{
/// <inheritdoc />
public partial class keeptrackofusersoickedforsubmission : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Submitted",
table: "SongSuggestions",
newName: "UserHasSubmitted");
migrationBuilder.AddColumn<bool>(
name: "WasChosenForSuggestionThisRound",
table: "Users",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "HasUsedSuggestion",
table: "SongSuggestions",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "SuggestionHelperId",
table: "SongSuggestions",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_SongSuggestions_SuggestionHelperId",
table: "SongSuggestions",
column: "SuggestionHelperId");
migrationBuilder.AddForeignKey(
name: "FK_SongSuggestions_SuggestionHelpers_SuggestionHelperId",
table: "SongSuggestions",
column: "SuggestionHelperId",
principalTable: "SuggestionHelpers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_SongSuggestions_SuggestionHelpers_SuggestionHelperId",
table: "SongSuggestions");
migrationBuilder.DropIndex(
name: "IX_SongSuggestions_SuggestionHelperId",
table: "SongSuggestions");
migrationBuilder.DropColumn(
name: "WasChosenForSuggestionThisRound",
table: "Users");
migrationBuilder.DropColumn(
name: "HasUsedSuggestion",
table: "SongSuggestions");
migrationBuilder.DropColumn(
name: "SuggestionHelperId",
table: "SongSuggestions");
migrationBuilder.RenameColumn(
name: "UserHasSubmitted",
table: "SongSuggestions",
newName: "Submitted");
}
}
}