Update SurveyLib and add support for multiple answer questions
This commit is contained in:
parent
00b422b8f3
commit
690eaaa32f
4 changed files with 401 additions and 6 deletions
|
|
@ -0,0 +1,60 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SurveyBackend.Infrastructure.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Updateanswers : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Answers",
|
||||
table: "Answers");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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" });
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue