83 lines
2.7 KiB
C#
83 lines
2.7 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|