From dac80b6415e6584a2084be29b718cfce592f643a Mon Sep 17 00:00:00 2001 From: Pavel Zhur Date: Sat, 28 Sep 2024 16:55:01 +0300 Subject: [PATCH] added constraints topics column --- .../20240928135019_Media12.Designer.cs | 903 ++++++++++++++++++ .../Migrations/20240928135019_Media12.cs | 28 + .../Migrations/VideosDatabaseModelSnapshot.cs | 3 + .../Models/AlbumConstraint.cs | 3 + 4 files changed, 937 insertions(+) create mode 100644 OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240928135019_Media12.Designer.cs create mode 100644 OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240928135019_Media12.cs diff --git a/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240928135019_Media12.Designer.cs b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240928135019_Media12.Designer.cs new file mode 100644 index 00000000..9ef0e46b --- /dev/null +++ b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240928135019_Media12.Designer.cs @@ -0,0 +1,903 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using OneShelf.Videos.Database; + +#nullable disable + +namespace OneShelf.Videos.Database.Migrations.VideosDatabaseMigrations +{ + [DbContext(typeof(VideosDatabase))] + [Migration("20240928135019_Media12")] + partial class Media12 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Album", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Albums"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.AlbumConstraint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("After") + .HasColumnType("datetime2"); + + b.Property("AlbumId") + .HasColumnType("int"); + + b.Property("Before") + .HasColumnType("datetime2"); + + b.Property("Include") + .HasColumnType("bit"); + + b.Property("IsSquare") + .HasColumnType("bit"); + + b.Property("StaticMessageSelectedType") + .HasColumnType("nvarchar(max)"); + + b.Property("StaticTopicId") + .HasColumnType("int"); + + b.Property("TopicId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AlbumId"); + + b.ToTable("AlbumConstraints"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.InventoryItem", b => + { + b.Property("DatabaseInventoryItemId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DatabaseInventoryItemId")); + + b.Property("BaseUrl") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ContributorInfoDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("ContributorInfoProfilePictureBaseUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsPhoto") + .HasColumnType("bit"); + + b.Property("IsVideo") + .HasColumnType("bit"); + + b.Property("MediaMetadataCreationTime") + .HasColumnType("datetime2"); + + b.Property("MediaMetadataHeight") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaMetadataPhotoApertureFNumber") + .HasColumnType("real"); + + b.Property("MediaMetadataPhotoCameraMake") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaMetadataPhotoCameraModel") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaMetadataPhotoExposureTime") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaMetadataPhotoFocalLength") + .HasColumnType("real"); + + b.Property("MediaMetadataPhotoIsoEquivalent") + .HasColumnType("int"); + + b.Property("MediaMetadataVideoCameraMake") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaMetadataVideoCameraModel") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaMetadataVideoFps") + .HasColumnType("float"); + + b.Property("MediaMetadataVideoStatus") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaMetadataWidth") + .HasColumnType("nvarchar(max)"); + + b.Property("MimeType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProductUrl") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SyncDate") + .HasColumnType("datetime2"); + + b.HasKey("DatabaseInventoryItemId"); + + b.ToTable("InventoryItems"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveChat", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("LiveChats"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveDownloadedItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FileName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("LiveMediaMediaId") + .HasColumnType("bigint"); + + b.Property("ThumbnailFileName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("FileName") + .IsUnique(); + + b.HasIndex("LiveMediaMediaId") + .IsUnique(); + + b.ToTable("LiveDownloadedItems"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveMedia", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("LiveTopicLiveChatId") + .HasColumnType("bigint"); + + b.Property("DocumentAttributeTypes") + .HasColumnType("nvarchar(max)"); + + b.Property("DocumentAttributes") + .HasColumnType("nvarchar(max)"); + + b.Property("Duration") + .HasColumnType("float"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("Flags") + .HasColumnType("nvarchar(max)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsForwarded") + .HasColumnType("bit"); + + b.Property("LiveTopicId") + .HasColumnType("int"); + + b.Property("MediaDate") + .HasColumnType("datetime2"); + + b.Property("MediaFlags") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.Property("MediaType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MessageDate") + .HasColumnType("datetime2"); + + b.Property("MimeType") + .HasColumnType("nvarchar(max)"); + + b.Property("SelectedType") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("nvarchar(max)") + .HasComputedColumnSql("\r\ncase \r\nwhen type = 'Photo' then 'Photo' \r\nwhen MimeType like 'video/%' then 'Video' \r\nwhen mimetype = 'image/webp' then null \r\nwhen mimetype = 'application/x-tgsticker' then null\r\nwhen MimeType like 'image/%' then 'Photo' \r\nelse null\r\nend\r\n"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("VideoFlags") + .HasColumnType("nvarchar(max)"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id", "LiveTopicLiveChatId"); + + b.HasIndex("LiveTopicId", "LiveTopicLiveChatId"); + + b.ToTable("LiveMediae"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveTopic", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("LiveChatId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id", "LiveChatId"); + + b.HasIndex("LiveChatId"); + + b.ToTable("LiveTopics"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Media", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("LiveChatId") + .HasColumnType("bigint"); + + b.Property("LiveMediaId") + .HasColumnType("int"); + + b.Property("StaticChatId") + .HasColumnType("bigint"); + + b.Property("StaticMessageId") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("LiveChatId"); + + b.HasIndex("LiveMediaId", "LiveChatId") + .IsUnique() + .HasFilter("[LiveMediaId] IS NOT NULL AND [LiveChatId] IS NOT NULL"); + + b.HasIndex("StaticChatId", "StaticMessageId") + .IsUnique() + .HasFilter("[StaticChatId] IS NOT NULL AND [StaticMessageId] IS NOT NULL"); + + b.ToTable("Mediae"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticChat", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StaticChatFolderId") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("StaticChatFolderId") + .IsUnique(); + + b.ToTable("StaticChats"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticChatFolder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Root") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("StaticChatFolders"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticMessage", b => + { + b.Property("StaticChatId") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("int"); + + b.Property("Action") + .HasColumnType("nvarchar(max)"); + + b.Property("Actor") + .HasColumnType("nvarchar(max)"); + + b.Property("ActorId") + .HasColumnType("nvarchar(max)"); + + b.Property("Boosts") + .HasColumnType("int"); + + b.Property("ContactInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DateUnixtime") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Duration") + .HasColumnType("int"); + + b.Property("DurationSeconds") + .HasColumnType("int"); + + b.Property("Edited") + .HasColumnType("datetime2"); + + b.Property("EditedUnixtime") + .HasColumnType("nvarchar(max)"); + + b.Property("File") + .HasColumnType("nvarchar(max)"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("ForwardedFrom") + .HasColumnType("nvarchar(max)"); + + b.Property("From") + .HasColumnType("nvarchar(max)"); + + b.Property("FromId") + .HasColumnType("nvarchar(max)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("InlineBotButtons") + .HasColumnType("nvarchar(max)"); + + b.Property("Inviter") + .HasColumnType("nvarchar(max)"); + + b.Property("LiveLocationPeriodSeconds") + .HasColumnType("int"); + + b.Property("LocationInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaType") + .HasColumnType("nvarchar(max)"); + + b.Property("Members") + .HasColumnType("nvarchar(max)"); + + b.Property("MessageId") + .HasColumnType("int"); + + b.Property("MimeType") + .HasColumnType("nvarchar(max)"); + + b.Property("NewIconEmojiId") + .HasColumnType("bigint"); + + b.Property("NewTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("Performer") + .HasColumnType("nvarchar(max)"); + + b.Property("Photo") + .HasColumnType("nvarchar(max)"); + + b.Property("Poll") + .HasColumnType("nvarchar(max)"); + + b.Property("ReplyToMessageId") + .HasColumnType("int"); + + b.Property("ReplyToPeerId") + .HasColumnType("nvarchar(max)"); + + b.Property("SavedFrom") + .HasColumnType("nvarchar(max)"); + + b.Property("ScheduleDate") + .HasColumnType("int"); + + b.Property("SelectedType") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("nvarchar(max)") + .HasComputedColumnSql("case when photo is not null then 'photo' when mimetype like 'video/%' and isnull(mediatype, 'null') in ('video_file', 'null') then 'video' else null end"); + + b.Property("StaticTopicRootMessageIdOr0") + .HasColumnType("int"); + + b.Property("StickerEmoji") + .HasColumnType("nvarchar(max)"); + + b.Property("Text") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TextEntities") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Thumbnail") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ViaBot") + .HasColumnType("nvarchar(max)"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("StaticChatId", "Id"); + + b.HasIndex("StaticChatId", "StaticTopicRootMessageIdOr0"); + + b.ToTable("StaticMessages"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticTopic", b => + { + b.Property("StaticChatId") + .HasColumnType("bigint"); + + b.Property("RootMessageIdOr0") + .HasColumnType("int"); + + b.Property("Id") + .HasColumnType("int"); + + b.Property("OriginalTitle") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("StaticChatId", "RootMessageIdOr0"); + + b.ToTable("StaticTopics"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Topic", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("LiveChatId") + .HasColumnType("bigint"); + + b.Property("LiveTopicId") + .HasColumnType("int"); + + b.Property("StaticChatId") + .HasColumnType("bigint"); + + b.Property("StaticTopicRootMessageIdOr0") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LiveChatId"); + + b.HasIndex("LiveTopicId", "LiveChatId") + .IsUnique() + .HasFilter("[LiveTopicId] IS NOT NULL AND [LiveChatId] IS NOT NULL"); + + b.HasIndex("StaticChatId", "StaticTopicRootMessageIdOr0") + .IsUnique() + .HasFilter("[StaticChatId] IS NOT NULL AND [StaticTopicRootMessageIdOr0] IS NOT NULL"); + + b.ToTable("Topics"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.UploadedAlbum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AlbumId") + .HasColumnType("int"); + + b.Property("GoogleAlbumId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AlbumId") + .IsUnique(); + + b.ToTable("UploadedAlbums"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.UploadedItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("FileNameTimestamp") + .HasColumnType("datetime2"); + + b.Property("Json") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MediaId") + .HasColumnType("int"); + + b.Property("MediaItemId") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaItemIsPhoto") + .HasColumnType("bit"); + + b.Property("MediaItemIsVideo") + .HasColumnType("bit"); + + b.Property("MediaItemMetadataCreationTime") + .HasColumnType("datetime2"); + + b.Property("MediaItemMimeType") + .HasColumnType("nvarchar(max)"); + + b.Property("MediaItemSyncDate") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("nvarchar(max)"); + + b.Property("StatusCode") + .HasColumnType("int"); + + b.Property("StatusMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("TelegramPublishedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("MediaId") + .IsUnique(); + + b.ToTable("UploadedItems"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.AlbumConstraint", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Album", "Album") + .WithMany("Constraints") + .HasForeignKey("AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Album"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveMedia", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Live.LiveTopic", "LiveTopic") + .WithMany("LiveMediae") + .HasForeignKey("LiveTopicId", "LiveTopicLiveChatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LiveTopic"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveTopic", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Live.LiveChat", "LiveChat") + .WithMany("LiveTopics") + .HasForeignKey("LiveChatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LiveChat"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Media", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Live.LiveChat", "LiveChat") + .WithMany("Mediae") + .HasForeignKey("LiveChatId"); + + b.HasOne("OneShelf.Videos.Database.Models.Static.StaticChat", "StaticChat") + .WithMany("Mediae") + .HasForeignKey("StaticChatId"); + + b.HasOne("OneShelf.Videos.Database.Models.Live.LiveMedia", "LiveMedia") + .WithOne("Media") + .HasForeignKey("OneShelf.Videos.Database.Models.Media", "LiveMediaId", "LiveChatId"); + + b.HasOne("OneShelf.Videos.Database.Models.Static.StaticMessage", "StaticMessage") + .WithOne("Media") + .HasForeignKey("OneShelf.Videos.Database.Models.Media", "StaticChatId", "StaticMessageId"); + + b.Navigation("LiveChat"); + + b.Navigation("LiveMedia"); + + b.Navigation("StaticChat"); + + b.Navigation("StaticMessage"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticChat", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Static.StaticChatFolder", "StaticChatFolder") + .WithOne("StaticChat") + .HasForeignKey("OneShelf.Videos.Database.Models.Static.StaticChat", "StaticChatFolderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("StaticChatFolder"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticMessage", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Static.StaticChat", "StaticChat") + .WithMany("Messages") + .HasForeignKey("StaticChatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("OneShelf.Videos.Database.Models.Static.StaticTopic", "StaticTopic") + .WithMany("StaticMessages") + .HasForeignKey("StaticChatId", "StaticTopicRootMessageIdOr0"); + + b.Navigation("StaticChat"); + + b.Navigation("StaticTopic"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticTopic", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Static.StaticChat", "StaticChat") + .WithMany() + .HasForeignKey("StaticChatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("StaticChat"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Topic", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Live.LiveChat", "LiveChat") + .WithMany("Topics") + .HasForeignKey("LiveChatId"); + + b.HasOne("OneShelf.Videos.Database.Models.Static.StaticChat", "StaticChat") + .WithMany("Topics") + .HasForeignKey("StaticChatId"); + + b.HasOne("OneShelf.Videos.Database.Models.Live.LiveTopic", "LiveTopic") + .WithOne("Topic") + .HasForeignKey("OneShelf.Videos.Database.Models.Topic", "LiveTopicId", "LiveChatId"); + + b.HasOne("OneShelf.Videos.Database.Models.Static.StaticTopic", "StaticTopic") + .WithOne("Topic") + .HasForeignKey("OneShelf.Videos.Database.Models.Topic", "StaticChatId", "StaticTopicRootMessageIdOr0"); + + b.Navigation("LiveChat"); + + b.Navigation("LiveTopic"); + + b.Navigation("StaticChat"); + + b.Navigation("StaticTopic"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.UploadedAlbum", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Album", "Album") + .WithOne("UploadedAlbum") + .HasForeignKey("OneShelf.Videos.Database.Models.UploadedAlbum", "AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Album"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.UploadedItem", b => + { + b.HasOne("OneShelf.Videos.Database.Models.Media", "Media") + .WithOne("UploadedItem") + .HasForeignKey("OneShelf.Videos.Database.Models.UploadedItem", "MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Album", b => + { + b.Navigation("Constraints"); + + b.Navigation("UploadedAlbum"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveChat", b => + { + b.Navigation("LiveTopics"); + + b.Navigation("Mediae"); + + b.Navigation("Topics"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveMedia", b => + { + b.Navigation("Media"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Live.LiveTopic", b => + { + b.Navigation("LiveMediae"); + + b.Navigation("Topic"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Media", b => + { + b.Navigation("UploadedItem"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticChat", b => + { + b.Navigation("Mediae"); + + b.Navigation("Messages"); + + b.Navigation("Topics"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticChatFolder", b => + { + b.Navigation("StaticChat"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticMessage", b => + { + b.Navigation("Media"); + }); + + modelBuilder.Entity("OneShelf.Videos.Database.Models.Static.StaticTopic", b => + { + b.Navigation("StaticMessages"); + + b.Navigation("Topic"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240928135019_Media12.cs b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240928135019_Media12.cs new file mode 100644 index 00000000..eabf7227 --- /dev/null +++ b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240928135019_Media12.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace OneShelf.Videos.Database.Migrations.VideosDatabaseMigrations +{ + /// + public partial class Media12 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TopicId", + table: "AlbumConstraints", + type: "int", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "TopicId", + table: "AlbumConstraints"); + } + } +} diff --git a/OneShelf.Videos/OneShelf.Videos.Database/Migrations/VideosDatabaseModelSnapshot.cs b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/VideosDatabaseModelSnapshot.cs index cbdccb0d..bd21914c 100644 --- a/OneShelf.Videos/OneShelf.Videos.Database/Migrations/VideosDatabaseModelSnapshot.cs +++ b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/VideosDatabaseModelSnapshot.cs @@ -68,6 +68,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("StaticTopicId") .HasColumnType("int"); + b.Property("TopicId") + .HasColumnType("int"); + b.HasKey("Id"); b.HasIndex("AlbumId"); diff --git a/OneShelf.Videos/OneShelf.Videos.Database/Models/AlbumConstraint.cs b/OneShelf.Videos/OneShelf.Videos.Database/Models/AlbumConstraint.cs index 0a9b81be..277722c2 100644 --- a/OneShelf.Videos/OneShelf.Videos.Database/Models/AlbumConstraint.cs +++ b/OneShelf.Videos/OneShelf.Videos.Database/Models/AlbumConstraint.cs @@ -10,8 +10,11 @@ public class AlbumConstraint public bool Include { get; set; } + [Obsolete] public int? StaticTopicId { get; set; } + public int? TopicId { get; set; } + public MediaType? StaticMessageSelectedType { get; set; } public bool IsSquare { get; set; }