//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NostrStreamer.Database;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace NostrStreamer.Migrations
{
[DbContext(typeof(StreamerContext))]
[Migration("20230725105922_V2")]
partial class V2
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("NostrStreamer.Database.Payment", b =>
{
b.Property("PaymentHash")
.HasColumnType("text");
b.Property("Amount")
.HasColumnType("numeric(20,0)");
b.Property("Created")
.HasColumnType("timestamp with time zone");
b.Property("Invoice")
.IsRequired()
.HasColumnType("text");
b.Property("IsPaid")
.HasColumnType("boolean");
b.Property("Nostr")
.HasColumnType("text");
b.Property("PubKey")
.IsRequired()
.HasColumnType("text");
b.Property("Type")
.HasColumnType("integer");
b.HasKey("PaymentHash");
b.HasIndex("PubKey");
b.ToTable("Payments");
});
modelBuilder.Entity("NostrStreamer.Database.User", b =>
{
b.Property("PubKey")
.HasColumnType("text");
b.Property("Balance")
.HasColumnType("bigint");
b.Property("ContentWarning")
.HasColumnType("text");
b.Property("Image")
.HasColumnType("text");
b.Property("StreamKey")
.IsRequired()
.HasColumnType("text");
b.Property("Summary")
.HasColumnType("text");
b.Property("Tags")
.HasColumnType("text");
b.Property("Title")
.HasColumnType("text");
b.Property("Version")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("xid")
.HasColumnName("xmin");
b.HasKey("PubKey");
b.ToTable("Users");
});
modelBuilder.Entity("NostrStreamer.Database.UserStream", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ClientId")
.IsRequired()
.HasColumnType("text");
b.Property("Ends")
.HasColumnType("timestamp with time zone");
b.Property("Event")
.IsRequired()
.HasColumnType("text");
b.Property("PubKey")
.IsRequired()
.HasColumnType("text");
b.Property("Recording")
.HasColumnType("text");
b.Property("Starts")
.HasColumnType("timestamp with time zone");
b.Property("State")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("PubKey");
b.ToTable("Streams");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamGuest", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("PubKey")
.IsRequired()
.HasColumnType("text");
b.Property("Relay")
.HasColumnType("text");
b.Property("Role")
.HasColumnType("text");
b.Property("Sig")
.HasColumnType("text");
b.Property("StreamId")
.HasColumnType("uuid");
b.Property("ZapSplit")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("StreamId", "PubKey")
.IsUnique();
b.ToTable("Guests");
});
modelBuilder.Entity("NostrStreamer.Database.Payment", b =>
{
b.HasOne("NostrStreamer.Database.User", "User")
.WithMany("Payments")
.HasForeignKey("PubKey")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("NostrStreamer.Database.UserStream", b =>
{
b.HasOne("NostrStreamer.Database.User", "User")
.WithMany("Streams")
.HasForeignKey("PubKey")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamGuest", b =>
{
b.HasOne("NostrStreamer.Database.UserStream", "Stream")
.WithMany("Guests")
.HasForeignKey("StreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stream");
});
modelBuilder.Entity("NostrStreamer.Database.User", b =>
{
b.Navigation("Payments");
b.Navigation("Streams");
});
modelBuilder.Entity("NostrStreamer.Database.UserStream", b =>
{
b.Navigation("Guests");
});
#pragma warning restore 612, 618
}
}
}