1
0

20240403072242_Loadouts.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
  3. #nullable disable
  4. namespace Content.Server.Database.Migrations.Postgres
  5. {
  6. /// <inheritdoc />
  7. public partial class Loadouts : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "profile_role_loadout",
  14. columns: table => new
  15. {
  16. profile_role_loadout_id = table.Column<int>(type: "integer", nullable: false)
  17. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
  18. profile_id = table.Column<int>(type: "integer", nullable: false),
  19. role_name = table.Column<string>(type: "text", nullable: false)
  20. },
  21. constraints: table =>
  22. {
  23. table.PrimaryKey("PK_profile_role_loadout", x => x.profile_role_loadout_id);
  24. table.ForeignKey(
  25. name: "FK_profile_role_loadout_profile_profile_id",
  26. column: x => x.profile_id,
  27. principalTable: "profile",
  28. principalColumn: "profile_id",
  29. onDelete: ReferentialAction.Cascade);
  30. });
  31. migrationBuilder.CreateTable(
  32. name: "profile_loadout_group",
  33. columns: table => new
  34. {
  35. profile_loadout_group_id = table.Column<int>(type: "integer", nullable: false)
  36. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
  37. profile_role_loadout_id = table.Column<int>(type: "integer", nullable: false),
  38. group_name = table.Column<string>(type: "text", nullable: false)
  39. },
  40. constraints: table =>
  41. {
  42. table.PrimaryKey("PK_profile_loadout_group", x => x.profile_loadout_group_id);
  43. table.ForeignKey(
  44. name: "FK_profile_loadout_group_profile_role_loadout_profile_role_loa~",
  45. column: x => x.profile_role_loadout_id,
  46. principalTable: "profile_role_loadout",
  47. principalColumn: "profile_role_loadout_id",
  48. onDelete: ReferentialAction.Cascade);
  49. });
  50. migrationBuilder.CreateTable(
  51. name: "profile_loadout",
  52. columns: table => new
  53. {
  54. profile_loadout_id = table.Column<int>(type: "integer", nullable: false)
  55. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
  56. profile_loadout_group_id = table.Column<int>(type: "integer", nullable: false),
  57. loadout_name = table.Column<string>(type: "text", nullable: false)
  58. },
  59. constraints: table =>
  60. {
  61. table.PrimaryKey("PK_profile_loadout", x => x.profile_loadout_id);
  62. table.ForeignKey(
  63. name: "FK_profile_loadout_profile_loadout_group_profile_loadout_group~",
  64. column: x => x.profile_loadout_group_id,
  65. principalTable: "profile_loadout_group",
  66. principalColumn: "profile_loadout_group_id",
  67. onDelete: ReferentialAction.Cascade);
  68. });
  69. migrationBuilder.CreateIndex(
  70. name: "IX_profile_loadout_profile_loadout_group_id",
  71. table: "profile_loadout",
  72. column: "profile_loadout_group_id");
  73. migrationBuilder.CreateIndex(
  74. name: "IX_profile_loadout_group_profile_role_loadout_id",
  75. table: "profile_loadout_group",
  76. column: "profile_role_loadout_id");
  77. migrationBuilder.CreateIndex(
  78. name: "IX_profile_role_loadout_profile_id",
  79. table: "profile_role_loadout",
  80. column: "profile_id");
  81. }
  82. /// <inheritdoc />
  83. protected override void Down(MigrationBuilder migrationBuilder)
  84. {
  85. migrationBuilder.DropTable(
  86. name: "profile_loadout");
  87. migrationBuilder.DropTable(
  88. name: "profile_loadout_group");
  89. migrationBuilder.DropTable(
  90. name: "profile_role_loadout");
  91. }
  92. }
  93. }