20220324144654_AdminNotes.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #nullable disable
  2. using System;
  3. using Microsoft.EntityFrameworkCore.Migrations;
  4. using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
  5. namespace Content.Server.Database.Migrations.Postgres
  6. {
  7. public partial class AdminNotes : Migration
  8. {
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.CreateTable(
  12. name: "admin_notes",
  13. columns: table => new
  14. {
  15. admin_notes_id = table.Column<int>(type: "integer", nullable: false)
  16. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
  17. round_id = table.Column<int>(type: "integer", nullable: true),
  18. player_user_id = table.Column<Guid>(type: "uuid", nullable: false),
  19. message = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
  20. created_by_id = table.Column<Guid>(type: "uuid", nullable: false),
  21. created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
  22. last_edited_by_id = table.Column<Guid>(type: "uuid", nullable: false),
  23. last_edited_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
  24. deleted = table.Column<bool>(type: "boolean", nullable: false),
  25. deleted_by_id = table.Column<Guid>(type: "uuid", nullable: true),
  26. deleted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
  27. shown_to_player = table.Column<bool>(type: "boolean", nullable: false)
  28. },
  29. constraints: table =>
  30. {
  31. table.PrimaryKey("PK_admin_notes", x => x.admin_notes_id);
  32. table.ForeignKey(
  33. name: "FK_admin_notes_player_created_by_id",
  34. column: x => x.created_by_id,
  35. principalTable: "player",
  36. principalColumn: "user_id",
  37. onDelete: ReferentialAction.Cascade);
  38. table.ForeignKey(
  39. name: "FK_admin_notes_player_deleted_by_id",
  40. column: x => x.deleted_by_id,
  41. principalTable: "player",
  42. principalColumn: "user_id");
  43. table.ForeignKey(
  44. name: "FK_admin_notes_player_last_edited_by_id",
  45. column: x => x.last_edited_by_id,
  46. principalTable: "player",
  47. principalColumn: "user_id",
  48. onDelete: ReferentialAction.Cascade);
  49. table.ForeignKey(
  50. name: "FK_admin_notes_player_player_user_id",
  51. column: x => x.player_user_id,
  52. principalTable: "player",
  53. principalColumn: "user_id",
  54. onDelete: ReferentialAction.Cascade);
  55. table.ForeignKey(
  56. name: "FK_admin_notes_round_round_id",
  57. column: x => x.round_id,
  58. principalTable: "round",
  59. principalColumn: "round_id");
  60. });
  61. migrationBuilder.CreateIndex(
  62. name: "IX_admin_notes_created_by_id",
  63. table: "admin_notes",
  64. column: "created_by_id");
  65. migrationBuilder.CreateIndex(
  66. name: "IX_admin_notes_deleted_by_id",
  67. table: "admin_notes",
  68. column: "deleted_by_id");
  69. migrationBuilder.CreateIndex(
  70. name: "IX_admin_notes_last_edited_by_id",
  71. table: "admin_notes",
  72. column: "last_edited_by_id");
  73. migrationBuilder.CreateIndex(
  74. name: "IX_admin_notes_player_user_id",
  75. table: "admin_notes",
  76. column: "player_user_id");
  77. migrationBuilder.CreateIndex(
  78. name: "IX_admin_notes_round_id",
  79. table: "admin_notes",
  80. column: "round_id");
  81. }
  82. protected override void Down(MigrationBuilder migrationBuilder)
  83. {
  84. migrationBuilder.DropTable(
  85. name: "admin_notes");
  86. }
  87. }
  88. }