20231024041204_DropAdminLogEntity.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #nullable disable
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
  4. namespace Content.Server.Database.Migrations.Postgres
  5. {
  6. /// <inheritdoc />
  7. public partial class DropAdminLogEntity : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.DropTable(
  13. name: "admin_log_entity");
  14. }
  15. /// <inheritdoc />
  16. protected override void Down(MigrationBuilder migrationBuilder)
  17. {
  18. migrationBuilder.CreateTable(
  19. name: "admin_log_entity",
  20. columns: table => new
  21. {
  22. uid = table.Column<int>(type: "integer", nullable: false)
  23. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
  24. admin_log_id = table.Column<int>(type: "integer", nullable: true),
  25. admin_log_round_id = table.Column<int>(type: "integer", nullable: true),
  26. name = table.Column<string>(type: "text", nullable: true)
  27. },
  28. constraints: table =>
  29. {
  30. table.PrimaryKey("PK_admin_log_entity", x => x.uid);
  31. table.ForeignKey(
  32. name: "FK_admin_log_entity_admin_log_admin_log_id_admin_log_round_id",
  33. columns: x => new { x.admin_log_id, x.admin_log_round_id },
  34. principalTable: "admin_log",
  35. principalColumns: new[] { "admin_log_id", "round_id" });
  36. });
  37. migrationBuilder.CreateIndex(
  38. name: "IX_admin_log_entity_admin_log_id_admin_log_round_id",
  39. table: "admin_log_entity",
  40. columns: new[] { "admin_log_id", "admin_log_round_id" });
  41. }
  42. }
  43. }