using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace YarpGateway.Migrations { /// public partial class AddPendingServiceDiscovery : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "PendingServiceDiscoveries", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), K8sServiceName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), K8sNamespace = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), K8sClusterIP = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), DiscoveredPorts = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), Labels = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false), PodCount = table.Column(type: "integer", nullable: false), Status = table.Column(type: "integer", nullable: false), AssignedClusterId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), AssignedBy = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), AssignedAt = table.Column(type: "timestamp with time zone", nullable: true), DiscoveredAt = table.Column(type: "timestamp with time zone", nullable: false), IsDeleted = table.Column(type: "boolean", nullable: false), Version = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_PendingServiceDiscoveries", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_PendingServiceDiscoveries_DiscoveredAt", table: "PendingServiceDiscoveries", column: "DiscoveredAt"); migrationBuilder.CreateIndex( name: "IX_PendingServiceDiscoveries_K8sServiceName_K8sNamespace_IsDel~", table: "PendingServiceDiscoveries", columns: new[] { "K8sServiceName", "K8sNamespace", "IsDeleted" }, unique: true); migrationBuilder.CreateIndex( name: "IX_PendingServiceDiscoveries_Status", table: "PendingServiceDiscoveries", column: "Status"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PendingServiceDiscoveries"); } } }