using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SurveyBackend.Infrastructure.Data.Migrations { /// public partial class Updateanswers : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropPrimaryKey( name: "PK_Answers", table: "Answers"); migrationBuilder.AddColumn( name: "Id", table: "Answers", type: "INTEGER", nullable: false, defaultValue: 0) .Annotation("Sqlite:Autoincrement", true); migrationBuilder.Sql(@"UPDATE ""Answers"" SET ""Id"" = rowid;"); migrationBuilder.AddPrimaryKey( name: "PK_Answers", table: "Answers", column: "Id"); migrationBuilder.CreateIndex( name: "IX_Answers_CompletionId_QuestionId_AnswerText", table: "Answers", columns: new[] { "CompletionId", "QuestionId", "AnswerText" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropPrimaryKey( name: "PK_Answers", table: "Answers"); migrationBuilder.DropIndex( name: "IX_Answers_CompletionId_QuestionId_AnswerText", table: "Answers"); migrationBuilder.DropColumn( name: "Id", table: "Answers"); migrationBuilder.AddPrimaryKey( name: "PK_Answers", table: "Answers", columns: new[] { "CompletionId", "QuestionId" }); } } }