mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 05:30:13 +01:00
98 lines
3.2 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|