mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
Rename EventEndpoints VolunteerId to UserId
This commit is contained in:
97
WebApp/Migrations/20250530235051_RenameEventRegistration.cs
Normal file
97
WebApp/Migrations/20250530235051_RenameEventRegistration.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user