| | | 1 | | using Microsoft.EntityFrameworkCore.Migrations; |
| | | 2 | | |
| | | 3 | | #nullable disable |
| | | 4 | | |
| | | 5 | | namespace Chronicis.Api.Migrations |
| | | 6 | | { |
| | | 7 | | /// <inheritdoc /> |
| | | 8 | | public partial class AddQuestEntities : Migration |
| | | 9 | | { |
| | | 10 | | /// <inheritdoc /> |
| | | 11 | | protected override void Up(MigrationBuilder migrationBuilder) |
| | | 12 | | { |
| | 0 | 13 | | migrationBuilder.CreateTable( |
| | 0 | 14 | | name: "Quests", |
| | 0 | 15 | | columns: table => new |
| | 0 | 16 | | { |
| | 0 | 17 | | Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
| | 0 | 18 | | ArcId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
| | 0 | 19 | | Title = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false), |
| | 0 | 20 | | Description = table.Column<string>(type: "nvarchar(max)", nullable: true), |
| | 0 | 21 | | Status = table.Column<int>(type: "int", nullable: false), |
| | 0 | 22 | | IsGmOnly = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
| | 0 | 23 | | SortOrder = table.Column<int>(type: "int", nullable: false, defaultValue: 0), |
| | 0 | 24 | | CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
| | 0 | 25 | | CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), |
| | 0 | 26 | | UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), |
| | 0 | 27 | | RowVersion = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: false) |
| | 0 | 28 | | }, |
| | 0 | 29 | | constraints: table => |
| | 0 | 30 | | { |
| | 0 | 31 | | table.PrimaryKey("PK_Quests", x => x.Id); |
| | 0 | 32 | | table.ForeignKey( |
| | 0 | 33 | | name: "FK_Quests_Arcs_ArcId", |
| | 0 | 34 | | column: x => x.ArcId, |
| | 0 | 35 | | principalTable: "Arcs", |
| | 0 | 36 | | principalColumn: "Id", |
| | 0 | 37 | | onDelete: ReferentialAction.Cascade); |
| | 0 | 38 | | table.ForeignKey( |
| | 0 | 39 | | name: "FK_Quests_Users_CreatedBy", |
| | 0 | 40 | | column: x => x.CreatedBy, |
| | 0 | 41 | | principalTable: "Users", |
| | 0 | 42 | | principalColumn: "Id", |
| | 0 | 43 | | onDelete: ReferentialAction.Restrict); |
| | 0 | 44 | | }); |
| | | 45 | | |
| | 0 | 46 | | migrationBuilder.CreateTable( |
| | 0 | 47 | | name: "QuestUpdates", |
| | 0 | 48 | | columns: table => new |
| | 0 | 49 | | { |
| | 0 | 50 | | Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
| | 0 | 51 | | QuestId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
| | 0 | 52 | | SessionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
| | 0 | 53 | | Body = table.Column<string>(type: "nvarchar(max)", nullable: false), |
| | 0 | 54 | | CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
| | 0 | 55 | | CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false) |
| | 0 | 56 | | }, |
| | 0 | 57 | | constraints: table => |
| | 0 | 58 | | { |
| | 0 | 59 | | table.PrimaryKey("PK_QuestUpdates", x => x.Id); |
| | 0 | 60 | | table.ForeignKey( |
| | 0 | 61 | | name: "FK_QuestUpdates_Articles_SessionId", |
| | 0 | 62 | | column: x => x.SessionId, |
| | 0 | 63 | | principalTable: "Articles", |
| | 0 | 64 | | principalColumn: "Id", |
| | 0 | 65 | | onDelete: ReferentialAction.SetNull); |
| | 0 | 66 | | table.ForeignKey( |
| | 0 | 67 | | name: "FK_QuestUpdates_Quests_QuestId", |
| | 0 | 68 | | column: x => x.QuestId, |
| | 0 | 69 | | principalTable: "Quests", |
| | 0 | 70 | | principalColumn: "Id", |
| | 0 | 71 | | onDelete: ReferentialAction.Cascade); |
| | 0 | 72 | | table.ForeignKey( |
| | 0 | 73 | | name: "FK_QuestUpdates_Users_CreatedBy", |
| | 0 | 74 | | column: x => x.CreatedBy, |
| | 0 | 75 | | principalTable: "Users", |
| | 0 | 76 | | principalColumn: "Id", |
| | 0 | 77 | | onDelete: ReferentialAction.Restrict); |
| | 0 | 78 | | }); |
| | | 79 | | |
| | 0 | 80 | | migrationBuilder.CreateIndex( |
| | 0 | 81 | | name: "IX_Quest_ArcId", |
| | 0 | 82 | | table: "Quests", |
| | 0 | 83 | | column: "ArcId"); |
| | | 84 | | |
| | 0 | 85 | | migrationBuilder.CreateIndex( |
| | 0 | 86 | | name: "IX_Quest_ArcId_Status", |
| | 0 | 87 | | table: "Quests", |
| | 0 | 88 | | columns: new[] { "ArcId", "Status" }); |
| | | 89 | | |
| | 0 | 90 | | migrationBuilder.CreateIndex( |
| | 0 | 91 | | name: "IX_Quest_ArcId_UpdatedAt", |
| | 0 | 92 | | table: "Quests", |
| | 0 | 93 | | columns: new[] { "ArcId", "UpdatedAt" }); |
| | | 94 | | |
| | 0 | 95 | | migrationBuilder.CreateIndex( |
| | 0 | 96 | | name: "IX_Quests_CreatedBy", |
| | 0 | 97 | | table: "Quests", |
| | 0 | 98 | | column: "CreatedBy"); |
| | | 99 | | |
| | 0 | 100 | | migrationBuilder.CreateIndex( |
| | 0 | 101 | | name: "IX_QuestUpdate_QuestId_CreatedAt", |
| | 0 | 102 | | table: "QuestUpdates", |
| | 0 | 103 | | columns: new[] { "QuestId", "CreatedAt" }); |
| | | 104 | | |
| | 0 | 105 | | migrationBuilder.CreateIndex( |
| | 0 | 106 | | name: "IX_QuestUpdate_SessionId", |
| | 0 | 107 | | table: "QuestUpdates", |
| | 0 | 108 | | column: "SessionId"); |
| | | 109 | | |
| | 0 | 110 | | migrationBuilder.CreateIndex( |
| | 0 | 111 | | name: "IX_QuestUpdates_CreatedBy", |
| | 0 | 112 | | table: "QuestUpdates", |
| | 0 | 113 | | column: "CreatedBy"); |
| | 0 | 114 | | } |
| | | 115 | | |
| | | 116 | | /// <inheritdoc /> |
| | | 117 | | protected override void Down(MigrationBuilder migrationBuilder) |
| | | 118 | | { |
| | 0 | 119 | | migrationBuilder.DropTable( |
| | 0 | 120 | | name: "QuestUpdates"); |
| | | 121 | | |
| | 0 | 122 | | migrationBuilder.DropTable( |
| | 0 | 123 | | name: "Quests"); |
| | 0 | 124 | | } |
| | | 125 | | } |
| | | 126 | | } |