using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace NostrStreamer.Migrations { /// public partial class Endpoints : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "EndpointId", table: "Streams", type: "uuid", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); migrationBuilder.CreateTable( name: "Endpoints", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "text", nullable: false), App = table.Column(type: "text", nullable: false), Forward = table.Column(type: "text", nullable: false), Cost = table.Column(type: "integer", nullable: false), Capabilities = table.Column>(type: "text[]", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Endpoints", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_Streams_EndpointId", table: "Streams", column: "EndpointId"); migrationBuilder.CreateIndex( name: "IX_Endpoints_App", table: "Endpoints", column: "App", unique: true); migrationBuilder.AddForeignKey( name: "FK_Streams_Endpoints_EndpointId", table: "Streams", column: "EndpointId", principalTable: "Endpoints", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Streams_Endpoints_EndpointId", table: "Streams"); migrationBuilder.DropTable( name: "Endpoints"); migrationBuilder.DropIndex( name: "IX_Streams_EndpointId", table: "Streams"); migrationBuilder.DropColumn( name: "EndpointId", table: "Streams"); } } }