Files
hermes/WebApp/Migrations/20250530235051_RenameEventRegistration.cs
2025-05-31 01:51:48 +02:00

98 lines
3.2 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebApp.Migrations
{
/// <inheritdoc />
public partial class RenameEventRegistration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EventRegistrations_WebUsers_UserId",
table: "EventRegistrations");
migrationBuilder.DropPrimaryKey(
name: "PK_EventRegistrations",
table: "EventRegistrations");
migrationBuilder.DropIndex(
name: "IX_EventRegistrations_UserId",
table: "EventRegistrations");
migrationBuilder.DropColumn(
name: "VolunteerId",
table: "EventRegistrations");
migrationBuilder.AlterColumn<int>(
name: "UserId",
table: "EventRegistrations",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_EventRegistrations",
table: "EventRegistrations",
columns: new[] { "UserId", "EventId" });
migrationBuilder.AddForeignKey(
name: "FK_EventRegistrations_WebUsers_UserId",
table: "EventRegistrations",
column: "UserId",
principalTable: "WebUsers",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EventRegistrations_WebUsers_UserId",
table: "EventRegistrations");
migrationBuilder.DropPrimaryKey(
name: "PK_EventRegistrations",
table: "EventRegistrations");
migrationBuilder.AlterColumn<int>(
name: "UserId",
table: "EventRegistrations",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AddColumn<int>(
name: "VolunteerId",
table: "EventRegistrations",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddPrimaryKey(
name: "PK_EventRegistrations",
table: "EventRegistrations",
columns: new[] { "VolunteerId", "EventId" });
migrationBuilder.CreateIndex(
name: "IX_EventRegistrations_UserId",
table: "EventRegistrations",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_EventRegistrations_WebUsers_UserId",
table: "EventRegistrations",
column: "UserId",
principalTable: "WebUsers",
principalColumn: "UserId");
}
}
}