20220214060745_RoleBans.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Content.Server.Database.Migrations.Sqlite
  5. {
  6. public partial class RoleBans : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.CreateTable(
  11. name: "server_role_unban",
  12. columns: table => new
  13. {
  14. role_unban_id = table.Column<int>(type: "INTEGER", nullable: false)
  15. .Annotation("Sqlite:Autoincrement", true),
  16. ban_id = table.Column<int>(type: "INTEGER", nullable: false),
  17. unbanning_admin = table.Column<Guid>(type: "TEXT", nullable: true),
  18. unban_time = table.Column<DateTime>(type: "TEXT", nullable: false)
  19. },
  20. constraints: table =>
  21. {
  22. table.PrimaryKey("PK_server_role_unban", x => x.role_unban_id);
  23. table.ForeignKey(
  24. name: "FK_server_role_unban_server_ban_ban_id",
  25. column: x => x.ban_id,
  26. principalTable: "server_ban",
  27. principalColumn: "server_ban_id",
  28. onDelete: ReferentialAction.Cascade);
  29. });
  30. migrationBuilder.CreateTable(
  31. name: "server_role_ban",
  32. columns: table => new
  33. {
  34. server_role_ban_id = table.Column<int>(type: "INTEGER", nullable: false)
  35. .Annotation("Sqlite:Autoincrement", true),
  36. user_id = table.Column<Guid>(type: "TEXT", nullable: true),
  37. address = table.Column<string>(type: "TEXT", nullable: true),
  38. hwid = table.Column<byte[]>(type: "BLOB", nullable: true),
  39. ban_time = table.Column<DateTime>(type: "TEXT", nullable: false),
  40. expiration_time = table.Column<DateTime>(type: "TEXT", nullable: true),
  41. reason = table.Column<string>(type: "TEXT", nullable: false),
  42. banning_admin = table.Column<Guid>(type: "TEXT", nullable: true),
  43. unban_id = table.Column<int>(type: "INTEGER", nullable: true),
  44. role_id = table.Column<string>(type: "TEXT", nullable: false)
  45. },
  46. constraints: table =>
  47. {
  48. table.PrimaryKey("PK_server_role_ban", x => x.server_role_ban_id);
  49. table.ForeignKey(
  50. name: "FK_server_role_ban_server_role_unban__unban_id",
  51. column: x => x.unban_id,
  52. principalTable: "server_role_unban",
  53. principalColumn: "role_unban_id");
  54. });
  55. migrationBuilder.CreateIndex(
  56. name: "IX_server_role_ban__unban_id",
  57. table: "server_role_ban",
  58. column: "unban_id");
  59. migrationBuilder.CreateIndex(
  60. name: "IX_server_role_unban_ban_id",
  61. table: "server_role_unban",
  62. column: "ban_id");
  63. }
  64. protected override void Down(MigrationBuilder migrationBuilder)
  65. {
  66. migrationBuilder.DropTable(
  67. name: "server_role_ban");
  68. migrationBuilder.DropTable(
  69. name: "server_role_unban");
  70. }
  71. }
  72. }