20230106171505_InitialCreate.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace DataLayer.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class InitialCreate : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "Players",
  14. columns: table => new
  15. {
  16. Id = table.Column<int>(type: "int", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
  19. CharacterName = table.Column<string>(type: "nvarchar(max)", nullable: true),
  20. Background = table.Column<string>(type: "nvarchar(max)", nullable: true),
  21. Experience = table.Column<int>(type: "int", nullable: false),
  22. CC = table.Column<int>(type: "int", nullable: false),
  23. CT = table.Column<int>(type: "int", nullable: false),
  24. F = table.Column<int>(type: "int", nullable: false),
  25. E = table.Column<int>(type: "int", nullable: false),
  26. AG = table.Column<int>(type: "int", nullable: false),
  27. INT = table.Column<int>(type: "int", nullable: false),
  28. PER = table.Column<int>(type: "int", nullable: false),
  29. FM = table.Column<int>(type: "int", nullable: false),
  30. SOC = table.Column<int>(type: "int", nullable: false),
  31. MF = table.Column<int>(type: "int", nullable: false),
  32. CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  33. ModifiedDate = table.Column<DateTime>(type: "datetime2", nullable: false)
  34. },
  35. constraints: table =>
  36. {
  37. table.PrimaryKey("PK_Players", x => x.Id);
  38. });
  39. migrationBuilder.CreateTable(
  40. name: "Weapons",
  41. columns: table => new
  42. {
  43. Id = table.Column<int>(type: "int", nullable: false)
  44. .Annotation("SqlServer:Identity", "1, 1"),
  45. Range = table.Column<int>(type: "int", nullable: false),
  46. Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
  47. GPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
  48. Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
  49. Pene = table.Column<int>(type: "int", nullable: false),
  50. Mode = table.Column<string>(type: "nvarchar(max)", nullable: true),
  51. At = table.Column<string>(type: "nvarchar(max)", nullable: true),
  52. Rch = table.Column<string>(type: "nvarchar(max)", nullable: true),
  53. Attribute = table.Column<string>(type: "nvarchar(max)", nullable: true),
  54. CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  55. ModifiedDate = table.Column<DateTime>(type: "datetime2", nullable: false)
  56. },
  57. constraints: table =>
  58. {
  59. table.PrimaryKey("PK_Weapons", x => x.Id);
  60. });
  61. migrationBuilder.CreateTable(
  62. name: "PlayerWeapon",
  63. columns: table => new
  64. {
  65. PlayersId = table.Column<int>(type: "int", nullable: false),
  66. WeaponsId = table.Column<int>(type: "int", nullable: false)
  67. },
  68. constraints: table =>
  69. {
  70. table.PrimaryKey("PK_PlayerWeapon", x => new { x.PlayersId, x.WeaponsId });
  71. table.ForeignKey(
  72. name: "FK_PlayerWeapon_Players_PlayersId",
  73. column: x => x.PlayersId,
  74. principalTable: "Players",
  75. principalColumn: "Id",
  76. onDelete: ReferentialAction.Cascade);
  77. table.ForeignKey(
  78. name: "FK_PlayerWeapon_Weapons_WeaponsId",
  79. column: x => x.WeaponsId,
  80. principalTable: "Weapons",
  81. principalColumn: "Id",
  82. onDelete: ReferentialAction.Cascade);
  83. });
  84. migrationBuilder.CreateIndex(
  85. name: "IX_PlayerWeapon_WeaponsId",
  86. table: "PlayerWeapon",
  87. column: "WeaponsId");
  88. }
  89. /// <inheritdoc />
  90. protected override void Down(MigrationBuilder migrationBuilder)
  91. {
  92. migrationBuilder.DropTable(
  93. name: "PlayerWeapon");
  94. migrationBuilder.DropTable(
  95. name: "Players");
  96. migrationBuilder.DropTable(
  97. name: "Weapons");
  98. }
  99. }
  100. }