//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Musify.Infrastructure.Persistence;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Musify.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(Database))]
partial class DatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.InboxState", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Consumed")
.HasColumnType("timestamp with time zone");
b.Property("ConsumerId")
.HasColumnType("uuid");
b.Property("Delivered")
.HasColumnType("timestamp with time zone");
b.Property("ExpirationTime")
.HasColumnType("timestamp with time zone");
b.Property("LastSequenceNumber")
.HasColumnType("bigint");
b.Property("LockId")
.HasColumnType("uuid");
b.Property("MessageId")
.HasColumnType("uuid");
b.Property("ReceiveCount")
.HasColumnType("integer");
b.Property("Received")
.HasColumnType("timestamp with time zone");
b.Property("RowVersion")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("bytea");
b.HasKey("Id");
b.HasIndex("Delivered");
b.ToTable("InboxState");
});
modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxMessage", b =>
{
b.Property("SequenceNumber")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceNumber"));
b.Property("Body")
.IsRequired()
.HasColumnType("text");
b.Property("ContentType")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("ConversationId")
.HasColumnType("uuid");
b.Property("CorrelationId")
.HasColumnType("uuid");
b.Property("DestinationAddress")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("EnqueueTime")
.HasColumnType("timestamp with time zone");
b.Property("ExpirationTime")
.HasColumnType("timestamp with time zone");
b.Property("FaultAddress")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("Headers")
.HasColumnType("text");
b.Property("InboxConsumerId")
.HasColumnType("uuid");
b.Property("InboxMessageId")
.HasColumnType("uuid");
b.Property("InitiatorId")
.HasColumnType("uuid");
b.Property("MessageId")
.HasColumnType("uuid");
b.Property("MessageType")
.IsRequired()
.HasColumnType("text");
b.Property("OutboxId")
.HasColumnType("uuid");
b.Property("Properties")
.HasColumnType("text");
b.Property("RequestId")
.HasColumnType("uuid");
b.Property("ResponseAddress")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("SentTime")
.HasColumnType("timestamp with time zone");
b.Property("SourceAddress")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("SequenceNumber");
b.HasIndex("EnqueueTime");
b.HasIndex("ExpirationTime");
b.HasIndex("OutboxId", "SequenceNumber")
.IsUnique();
b.HasIndex("InboxMessageId", "InboxConsumerId", "SequenceNumber")
.IsUnique();
b.ToTable("OutboxMessage");
});
modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxState", b =>
{
b.Property("OutboxId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Created")
.HasColumnType("timestamp with time zone");
b.Property("Delivered")
.HasColumnType("timestamp with time zone");
b.Property("LastSequenceNumber")
.HasColumnType("bigint");
b.Property("LockId")
.HasColumnType("uuid");
b.Property("RowVersion")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("bytea");
b.HasKey("OutboxId");
b.HasIndex("Created");
b.ToTable("OutboxState");
});
modelBuilder.Entity("Musify.Domain.Entities.Artist", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("ExternalId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("NormalizedName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ExternalId")
.IsUnique();
b.ToTable("Artists");
});
modelBuilder.Entity("Musify.Domain.Entities.ListeningHistory", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ListenedAt")
.HasColumnType("timestamp with time zone");
b.Property("TrackId")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("TrackId");
b.HasIndex("UserId");
b.ToTable("ListeningHistory");
});
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Description")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("LifeCycleStatus")
.HasColumnType("integer");
b.Property("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("NormalizedName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("PlayLists");
});
modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AddedAt")
.HasColumnType("timestamp with time zone");
b.Property("PlayListId")
.HasColumnType("uuid");
b.Property("Position")
.HasColumnType("integer");
b.Property("TrackId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("PlayListId");
b.HasIndex("TrackId");
b.ToTable("PlayListHasTrack");
});
modelBuilder.Entity("Musify.Domain.Entities.Track", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DurationSeconds")
.HasColumnType("integer");
b.Property("LifeCycleStatus")
.HasColumnType("integer");
b.Property("NormalizedTitle")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Tracks");
b.UseTptMappingStrategy();
});
modelBuilder.Entity("Musify.Domain.Entities.TrackArtist", b =>
{
b.Property("TrackId")
.HasColumnType("uuid");
b.Property("ArtistId")
.HasColumnType("uuid");
b.Property("Position")
.HasColumnType("integer");
b.HasKey("TrackId", "ArtistId");
b.HasIndex("ArtistId");
b.ToTable("TrackArtist");
});
modelBuilder.Entity("Musify.Domain.Entities.Upload", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Bucket")
.IsRequired()
.HasColumnType("text");
b.Property("ContentType")
.IsRequired()
.HasColumnType("text");
b.Property("CreatedTime")
.HasColumnType("timestamp with time zone");
b.Property("Key")
.IsRequired()
.HasColumnType("text");
b.Property("State")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Upload");
});
modelBuilder.Entity("Musify.Domain.Entities.UploadIntent", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Bucket")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("ContentType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("ExpectedSizeBytes")
.HasColumnType("bigint");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("Key")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("ObjectName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Purpose")
.HasColumnType("integer");
b.Property("Status")
.HasColumnType("integer");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("UploadIntents");
});
modelBuilder.Entity("Musify.Domain.Entities.User", b =>
{
b.Property("Id")
.HasColumnType("bigint");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("FirstName")
.HasMaxLength(48)
.HasColumnType("character varying(48)");
b.Property("Name")
.IsRequired()
.HasMaxLength(48)
.HasColumnType("character varying(48)");
b.Property("NormalizedName")
.IsRequired()
.HasMaxLength(48)
.HasColumnType("character varying(48)");
b.Property("ProfilePictureUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property("SecondName")
.HasMaxLength(48)
.HasColumnType("character varying(48)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("User");
});
modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("TrackId")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("TrackId");
b.HasIndex("UserId");
b.ToTable("UserHasTrack");
});
modelBuilder.Entity("Musify.Infrastructure.MassTransit.Sagas.PlayListProcessingState", b =>
{
b.Property("CorrelationId")
.HasColumnType("uuid");
b.Property("Bucket")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CurrentState")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("PictureKey")
.HasColumnType("text");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("CorrelationId");
b.ToTable("PlayListProcessingState");
});
modelBuilder.Entity("Musify.Infrastructure.MassTransit.Sagas.TrackProcessingState", b =>
{
b.Property("CorrelationId")
.HasColumnType("uuid");
b.Property("AudioKey")
.HasColumnType("text");
b.Property("AudioProcessed")
.HasColumnType("boolean");
b.Property("Bucket")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CurrentState")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("PictureKey")
.HasColumnType("text");
b.Property("PictureProcessed")
.HasColumnType("boolean");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("CorrelationId");
b.ToTable("TrackProcessingState");
});
modelBuilder.Entity("Musify.Domain.Entities.ExternalTrack", b =>
{
b.HasBaseType("Musify.Domain.Entities.Track");
b.Property("ExternalId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Source")
.HasColumnType("integer");
b.HasIndex("Source", "ExternalId")
.IsUnique();
b.ToTable("ExternalTracks", (string)null);
});
modelBuilder.Entity("Musify.Domain.Entities.LocalTrack", b =>
{
b.HasBaseType("Musify.Domain.Entities.Track");
b.Property("OwnerUserId")
.HasColumnType("bigint");
b.HasIndex("OwnerUserId");
b.ToTable("LocalTracks", (string)null);
});
modelBuilder.Entity("MassTransit.EntityFrameworkCoreIntegration.OutboxMessage", b =>
{
b.HasOne("MassTransit.EntityFrameworkCoreIntegration.OutboxState", null)
.WithMany()
.HasForeignKey("OutboxId");
b.HasOne("MassTransit.EntityFrameworkCoreIntegration.InboxState", null)
.WithMany()
.HasForeignKey("InboxMessageId", "InboxConsumerId")
.HasPrincipalKey("MessageId", "ConsumerId");
});
modelBuilder.Entity("Musify.Domain.Entities.ListeningHistory", b =>
{
b.HasOne("Musify.Domain.Entities.Track", "Track")
.WithMany("ListeningHistories")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Musify.Domain.Entities.User", "User")
.WithMany("ListeningHistories")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Track");
b.Navigation("User");
});
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
{
b.HasOne("Musify.Domain.Entities.User", "User")
.WithMany("PlayLists")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("Musify.Domain.ValueObjects.PlayListPictures", "Pictures", b1 =>
{
b1.Property("PlayListId")
.HasColumnType("uuid");
b1.Property("LargeName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("LargePictureName");
b1.Property("MediumName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("MediumPictureName");
b1.Property("OriginalName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("OriginalPictureName");
b1.Property("SmallName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("SmallPictureName");
b1.HasKey("PlayListId");
b1.ToTable("PlayLists");
b1.WithOwner()
.HasForeignKey("PlayListId");
});
b.Navigation("Pictures");
b.Navigation("User");
});
modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b =>
{
b.HasOne("Musify.Domain.Entities.PlayList", "PlayList")
.WithMany("PlayListTracks")
.HasForeignKey("PlayListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Musify.Domain.Entities.Track", "Track")
.WithMany("PlayListTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PlayList");
b.Navigation("Track");
});
modelBuilder.Entity("Musify.Domain.Entities.Track", b =>
{
b.OwnsOne("Musify.Domain.ValueObjects.TrackAudio", "Audio", b1 =>
{
b1.Property("TrackId")
.HasColumnType("uuid");
b1.Property("DownloadRequested")
.HasColumnType("boolean")
.HasColumnName("DownloadRequested");
b1.Property("FolderName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("AudioFolderName");
b1.Property("LastRetryAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("LastRetryAt");
b1.Property("OriginalName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("OriginalAudioName");
b1.Property("RetryCount")
.HasColumnType("integer")
.HasColumnName("RetryCount");
b1.Property("TranscodeStatus")
.HasColumnType("integer")
.HasColumnName("AudioTranscodeProcessingStatus");
b1.HasKey("TrackId");
b1.ToTable("Tracks");
b1.WithOwner()
.HasForeignKey("TrackId");
});
b.OwnsOne("Musify.Domain.ValueObjects.TrackPictures", "Pictures", b1 =>
{
b1.Property("TrackId")
.HasColumnType("uuid");
b1.Property("LargeName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("LargePictureName");
b1.Property("MediumName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("MediumPictureName");
b1.Property("OriginalName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("OriginalPictureName");
b1.Property("ProcessingStatus")
.HasColumnType("integer")
.HasColumnName("PicturesProcessingStatus");
b1.Property("SmallName")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("SmallPictureName");
b1.HasKey("TrackId");
b1.ToTable("Tracks");
b1.WithOwner()
.HasForeignKey("TrackId");
});
b.Navigation("Audio")
.IsRequired();
b.Navigation("Pictures")
.IsRequired();
});
modelBuilder.Entity("Musify.Domain.Entities.TrackArtist", b =>
{
b.HasOne("Musify.Domain.Entities.Artist", "Artist")
.WithMany("TrackArtists")
.HasForeignKey("ArtistId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Musify.Domain.Entities.ExternalTrack", "Track")
.WithMany("TrackArtists")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Artist");
b.Navigation("Track");
});
modelBuilder.Entity("Musify.Domain.Entities.UploadIntent", b =>
{
b.HasOne("Musify.Domain.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b =>
{
b.HasOne("Musify.Domain.Entities.Track", "Track")
.WithMany("UserTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Musify.Domain.Entities.User", "User")
.WithMany("UserTracks")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Track");
b.Navigation("User");
});
modelBuilder.Entity("Musify.Domain.Entities.ExternalTrack", b =>
{
b.HasOne("Musify.Domain.Entities.Track", null)
.WithOne()
.HasForeignKey("Musify.Domain.Entities.ExternalTrack", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Musify.Domain.Entities.LocalTrack", b =>
{
b.HasOne("Musify.Domain.Entities.Track", null)
.WithOne()
.HasForeignKey("Musify.Domain.Entities.LocalTrack", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Musify.Domain.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerUserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Owner");
});
modelBuilder.Entity("Musify.Domain.Entities.Artist", b =>
{
b.Navigation("TrackArtists");
});
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
{
b.Navigation("PlayListTracks");
});
modelBuilder.Entity("Musify.Domain.Entities.Track", b =>
{
b.Navigation("ListeningHistories");
b.Navigation("PlayListTracks");
b.Navigation("UserTracks");
});
modelBuilder.Entity("Musify.Domain.Entities.User", b =>
{
b.Navigation("ListeningHistories");
b.Navigation("PlayLists");
b.Navigation("UserTracks");
});
modelBuilder.Entity("Musify.Domain.Entities.ExternalTrack", b =>
{
b.Navigation("TrackArtists");
});
#pragma warning restore 612, 618
}
}
}