1
0

20220324144649_AdminNotes.cs 4.2 KB

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