20241122174243_IPIntel.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Net;
  3. using Microsoft.EntityFrameworkCore.Migrations;
  4. using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
  5. #nullable disable
  6. namespace Content.Server.Database.Migrations.Postgres
  7. {
  8. /// <inheritdoc />
  9. public partial class IPIntel : Migration
  10. {
  11. /// <inheritdoc />
  12. protected override void Up(MigrationBuilder migrationBuilder)
  13. {
  14. migrationBuilder.CreateTable(
  15. name: "ipintel_cache",
  16. columns: table => new
  17. {
  18. ipintel_cache_id = table.Column<int>(type: "integer", nullable: false)
  19. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
  20. address = table.Column<IPAddress>(type: "inet", nullable: false),
  21. time = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
  22. score = table.Column<float>(type: "real", nullable: false)
  23. },
  24. constraints: table =>
  25. {
  26. table.PrimaryKey("PK_ipintel_cache", x => x.ipintel_cache_id);
  27. });
  28. migrationBuilder.Sql("CREATE UNIQUE INDEX idx_ipintel_cache_address ON ipintel_cache(address)");
  29. }
  30. /// <inheritdoc />
  31. protected override void Down(MigrationBuilder migrationBuilder)
  32. {
  33. migrationBuilder.DropTable(
  34. name: "ipintel_cache");
  35. }
  36. }
  37. }