using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace NostrStreamer.Migrations { /// public partial class V2 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "Event", table: "Users"); migrationBuilder.AddColumn( name: "Nostr", table: "Payments", type: "text", nullable: true); migrationBuilder.AddColumn( name: "Type", table: "Payments", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "Streams", columns: table => new { Id = table.Column(type: "uuid", nullable: false), PubKey = table.Column(type: "text", nullable: false), ClientId = table.Column(type: "text", nullable: false), Starts = table.Column(type: "timestamp with time zone", nullable: false), Ends = table.Column(type: "timestamp with time zone", nullable: true), State = table.Column(type: "integer", nullable: false), Event = table.Column(type: "text", nullable: false), Recording = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Streams", x => x.Id); table.ForeignKey( name: "FK_Streams_Users_PubKey", column: x => x.PubKey, principalTable: "Users", principalColumn: "PubKey", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Guests", columns: table => new { Id = table.Column(type: "uuid", nullable: false), StreamId = table.Column(type: "uuid", nullable: false), PubKey = table.Column(type: "text", nullable: false), Relay = table.Column(type: "text", nullable: true), Role = table.Column(type: "text", nullable: true), Sig = table.Column(type: "text", nullable: true), ZapSplit = table.Column(type: "numeric", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Guests", x => x.Id); table.ForeignKey( name: "FK_Guests_Streams_StreamId", column: x => x.StreamId, principalTable: "Streams", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Guests_StreamId_PubKey", table: "Guests", columns: new[] { "StreamId", "PubKey" }, unique: true); migrationBuilder.CreateIndex( name: "IX_Streams_PubKey", table: "Streams", column: "PubKey"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Guests"); migrationBuilder.DropTable( name: "Streams"); migrationBuilder.DropColumn( name: "Nostr", table: "Payments"); migrationBuilder.DropColumn( name: "Type", table: "Payments"); migrationBuilder.AddColumn( name: "Event", table: "Users", type: "text", nullable: true); } } }