survey-webapp/SurveyBackend/SurveyBackend.Infrastructure/Data/Migrations/20250418190738_Add CreatedBy to Survey.cs
2025-04-19 00:16:07 +05:00

49 lines
1.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SurveyBackend.Infrastructure.Data.Migrations
{
/// <inheritdoc />
public partial class AddCreatedBytoSurvey : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "CreatedBy",
table: "Surveys",
type: "INTEGER",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Surveys_CreatedBy",
table: "Surveys",
column: "CreatedBy");
migrationBuilder.AddForeignKey(
name: "FK_Surveys_Users_CreatedBy",
table: "Surveys",
column: "CreatedBy",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Surveys_Users_CreatedBy",
table: "Surveys");
migrationBuilder.DropIndex(
name: "IX_Surveys_CreatedBy",
table: "Surveys");
migrationBuilder.DropColumn(
name: "CreatedBy",
table: "Surveys");
}
}
}