< Summary

Information
Class: Chronicis.Api.Migrations.AddQuestEntities
Assembly: Chronicis.Api
File(s): /home/runner/work/chronicis/chronicis/src/Chronicis.Api/Migrations/20260206000000_AddQuestEntities.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 99
Coverable lines: 99
Total lines: 126
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Up(...)100%210%
Down(...)100%210%

File(s)

/home/runner/work/chronicis/chronicis/src/Chronicis.Api/Migrations/20260206000000_AddQuestEntities.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore.Migrations;
 2
 3#nullable disable
 4
 5namespace Chronicis.Api.Migrations
 6{
 7    /// <inheritdoc />
 8    public partial class AddQuestEntities : Migration
 9    {
 10        /// <inheritdoc />
 11        protected override void Up(MigrationBuilder migrationBuilder)
 12        {
 013            migrationBuilder.CreateTable(
 014                name: "Quests",
 015                columns: table => new
 016                {
 017                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
 018                    ArcId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
 019                    Title = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false),
 020                    Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
 021                    Status = table.Column<int>(type: "int", nullable: false),
 022                    IsGmOnly = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
 023                    SortOrder = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
 024                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
 025                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
 026                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
 027                    RowVersion = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: false)
 028                },
 029                constraints: table =>
 030                {
 031                    table.PrimaryKey("PK_Quests", x => x.Id);
 032                    table.ForeignKey(
 033                        name: "FK_Quests_Arcs_ArcId",
 034                        column: x => x.ArcId,
 035                        principalTable: "Arcs",
 036                        principalColumn: "Id",
 037                        onDelete: ReferentialAction.Cascade);
 038                    table.ForeignKey(
 039                        name: "FK_Quests_Users_CreatedBy",
 040                        column: x => x.CreatedBy,
 041                        principalTable: "Users",
 042                        principalColumn: "Id",
 043                        onDelete: ReferentialAction.Restrict);
 044                });
 45
 046            migrationBuilder.CreateTable(
 047                name: "QuestUpdates",
 048                columns: table => new
 049                {
 050                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
 051                    QuestId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
 052                    SessionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
 053                    Body = table.Column<string>(type: "nvarchar(max)", nullable: false),
 054                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
 055                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
 056                },
 057                constraints: table =>
 058                {
 059                    table.PrimaryKey("PK_QuestUpdates", x => x.Id);
 060                    table.ForeignKey(
 061                        name: "FK_QuestUpdates_Articles_SessionId",
 062                        column: x => x.SessionId,
 063                        principalTable: "Articles",
 064                        principalColumn: "Id",
 065                        onDelete: ReferentialAction.SetNull);
 066                    table.ForeignKey(
 067                        name: "FK_QuestUpdates_Quests_QuestId",
 068                        column: x => x.QuestId,
 069                        principalTable: "Quests",
 070                        principalColumn: "Id",
 071                        onDelete: ReferentialAction.Cascade);
 072                    table.ForeignKey(
 073                        name: "FK_QuestUpdates_Users_CreatedBy",
 074                        column: x => x.CreatedBy,
 075                        principalTable: "Users",
 076                        principalColumn: "Id",
 077                        onDelete: ReferentialAction.Restrict);
 078                });
 79
 080            migrationBuilder.CreateIndex(
 081                name: "IX_Quest_ArcId",
 082                table: "Quests",
 083                column: "ArcId");
 84
 085            migrationBuilder.CreateIndex(
 086                name: "IX_Quest_ArcId_Status",
 087                table: "Quests",
 088                columns: new[] { "ArcId", "Status" });
 89
 090            migrationBuilder.CreateIndex(
 091                name: "IX_Quest_ArcId_UpdatedAt",
 092                table: "Quests",
 093                columns: new[] { "ArcId", "UpdatedAt" });
 94
 095            migrationBuilder.CreateIndex(
 096                name: "IX_Quests_CreatedBy",
 097                table: "Quests",
 098                column: "CreatedBy");
 99
 0100            migrationBuilder.CreateIndex(
 0101                name: "IX_QuestUpdate_QuestId_CreatedAt",
 0102                table: "QuestUpdates",
 0103                columns: new[] { "QuestId", "CreatedAt" });
 104
 0105            migrationBuilder.CreateIndex(
 0106                name: "IX_QuestUpdate_SessionId",
 0107                table: "QuestUpdates",
 0108                column: "SessionId");
 109
 0110            migrationBuilder.CreateIndex(
 0111                name: "IX_QuestUpdates_CreatedBy",
 0112                table: "QuestUpdates",
 0113                column: "CreatedBy");
 0114        }
 115
 116        /// <inheritdoc />
 117        protected override void Down(MigrationBuilder migrationBuilder)
 118        {
 0119            migrationBuilder.DropTable(
 0120                name: "QuestUpdates");
 121
 0122            migrationBuilder.DropTable(
 0123                name: "Quests");
 0124        }
 125    }
 126}