49 lines
1.4 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|