2248a2b757
Reviewed-on: #11 Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Co-committed-by: Marek Jasiński <jasins.marek@gmail.com>
50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace NexusReader.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddQuizResults : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "QuizResults",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
UserId = table.Column<string>(type: "text", nullable: false),
|
|
Topic = table.Column<string>(type: "text", nullable: false),
|
|
Score = table.Column<int>(type: "integer", nullable: false),
|
|
TotalQuestions = table.Column<int>(type: "integer", nullable: false),
|
|
CompletedDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_QuizResults", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_QuizResults_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_QuizResults_UserId",
|
|
table: "QuizResults",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "QuizResults");
|
|
}
|
|
}
|
|
}
|