Files
chapter-organizer/Data/Migrations/20250903121202_StudentAddEmailPhone.cs

100 lines
2.9 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations
{
/// <inheritdoc />
public partial class StudentAddEmailPhone : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "EventId",
table: "Teams",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "Teams",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AlterColumn<int>(
name: "OfficerRole",
table: "Students",
type: "INTEGER",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "Email",
table: "Students",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PhoneNumber",
table: "Students",
type: "TEXT",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Teams_EventId",
table: "Teams",
column: "EventId");
migrationBuilder.AddForeignKey(
name: "FK_Teams_Events_EventId",
table: "Teams",
column: "EventId",
principalTable: "Events",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Teams_Events_EventId",
table: "Teams");
migrationBuilder.DropIndex(
name: "IX_Teams_EventId",
table: "Teams");
migrationBuilder.DropColumn(
name: "EventId",
table: "Teams");
migrationBuilder.DropColumn(
name: "Name",
table: "Teams");
migrationBuilder.DropColumn(
name: "Email",
table: "Students");
migrationBuilder.DropColumn(
name: "PhoneNumber",
table: "Students");
migrationBuilder.AlterColumn<string>(
name: "OfficerRole",
table: "Students",
type: "TEXT",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
}
}
}