using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace WebApp.Migrations { /// public partial class RenameEventRegistration : Migration { /// 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( 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); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_EventRegistrations_WebUsers_UserId", table: "EventRegistrations"); migrationBuilder.DropPrimaryKey( name: "PK_EventRegistrations", table: "EventRegistrations"); migrationBuilder.AlterColumn( name: "UserId", table: "EventRegistrations", type: "integer", nullable: true, oldClrType: typeof(int), oldType: "integer"); migrationBuilder.AddColumn( 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"); } } }