From 42520a3cc55d2410497cf30a6d7383af1ce68c0c Mon Sep 17 00:00:00 2001 From: imaun Date: Mon, 5 Jun 2023 19:52:09 +0330 Subject: [PATCH] add-migration FileUpload_ContentType SQL Server --- ...5162129_FileUpload_ContentType.Designer.cs | 1604 +++++++++++++++++ .../20230605162129_FileUpload_ContentType.cs | 26 + .../BehlogSqlServerDbContextModelSnapshot.cs | 5 + 3 files changed, 1635 insertions(+) create mode 100644 src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/20230605162129_FileUpload_ContentType.Designer.cs create mode 100644 src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/20230605162129_FileUpload_ContentType.cs diff --git a/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/20230605162129_FileUpload_ContentType.Designer.cs b/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/20230605162129_FileUpload_ContentType.Designer.cs new file mode 100644 index 0000000..f67e16d --- /dev/null +++ b/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/20230605162129_FileUpload_ContentType.Designer.cs @@ -0,0 +1,1604 @@ +// +using System; +using Behlog.Cms.EntityFrameworkCore.SqlServer; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Behlog.Cms.EntityFrameworkCore.SqlServer.Migrations +{ + [DbContext(typeof(BehlogSqlServerDbContext))] + [Migration("20230605162129_FileUpload_ContentType")] + partial class FileUpload_ContentType + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Behlog.Cms.Domain.Comment", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorName") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("AuthorUserId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Body") + .IsRequired() + .HasMaxLength(4000) + .IsUnicode(true) + .HasColumnType("nvarchar(4000)"); + + b.Property("BodyType") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedByIp") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatedByUserId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("LastStatusChangedOn") + .HasColumnType("datetime2"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("LastUpdatedByIp") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastUpdatedByUserId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Title") + .HasMaxLength(500) + .IsUnicode(true) + .HasColumnType("nvarchar(500)"); + + b.Property("WebUrl") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.ToTable("Comment", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Attributes") + .HasColumnType("nTEXT"); + + b.Property("Author") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("AuthorEmail") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("ComponentType") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(true) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatedByIp") + .HasMaxLength(50) + .IsUnicode(true) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatedByUserId") + .HasMaxLength(100) + .IsUnicode(true) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("IsRtl") + .HasColumnType("bit"); + + b.Property("Keywords") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("LastUpdatedByIp") + .HasMaxLength(50) + .IsUnicode(true) + .HasColumnType("nvarchar(50)"); + + b.Property("LastUpdatedByUserId") + .HasMaxLength(100) + .IsUnicode(true) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("ViewPath") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("WebsiteId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("LangId"); + + b.HasIndex("WebsiteId"); + + b.ToTable("Component", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Content", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AltTitle") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("AuthorUserDisplayName") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("AuthorUserId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("AuthorUserName") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("Body") + .IsUnicode(true) + .HasColumnType("nTEXT"); + + b.Property("BodyType") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("ContentTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("CoverPhoto") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("CreatedByIp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedByUserId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("IconName") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("LangCode") + .HasMaxLength(10) + .IsUnicode(true) + .HasColumnType("nvarchar(10)"); + + b.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastStatusChangedDate") + .HasColumnType("datetime2"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("LastUpdatedByIp") + .HasColumnType("nvarchar(max)"); + + b.Property("LastUpdatedByUserId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("OrderNum") + .HasColumnType("int"); + + b.Property("Password") + .HasMaxLength(100) + .IsUnicode(true) + .HasColumnType("nvarchar(100)"); + + b.Property("PublishDate") + .HasColumnType("datetime2"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Summary") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("ViewPath") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("WebsiteId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ContentTypeId"); + + b.HasIndex("LangId"); + + b.ToTable("Content", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentCategory", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AltTitle") + .HasMaxLength(500) + .IsUnicode(true) + .HasColumnType("nvarchar(500)"); + + b.Property("ContentTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedByIp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedByUserId") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastStatusChangedOn") + .HasColumnType("datetime2"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("LastUpdatedByIp") + .HasColumnType("nvarchar(max)"); + + b.Property("LastUpdatedByUserId") + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("WebsiteId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ContentTypeId"); + + b.HasIndex("LangId"); + + b.HasIndex("WebsiteId"); + + b.ToTable("ContentCategory", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentCategoryItem", b => + { + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("CategoryId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("ContentId", "CategoryId"); + + b.HasIndex("CategoryId"); + + b.ToTable("ContentCategoryItem", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentTag", b => + { + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("ContentId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("ContentTag", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastStatusChangedOn") + .HasColumnType("datetime2"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("SystemName") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(true) + .HasColumnType("nvarchar(50)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("LangId"); + + b.ToTable("ContentType", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentTypeTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ContentTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagSlug") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("TagTitle") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.HasKey("Id"); + + b.HasIndex("ContentTypeId"); + + b.HasIndex("LangId"); + + b.HasIndex("TagId", "ContentTypeId") + .IsUnique(); + + b.ToTable("ContentTypeTag", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.FileUpload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AltFileSize") + .HasColumnType("bigint"); + + b.Property("AltFileUrl") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("AltTitle") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("AlternateFilePath") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("ContentType") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("CreatedByIp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedByUserId") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("Extension") + .HasMaxLength(50) + .IsUnicode(true) + .HasColumnType("nvarchar(50)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FilePath") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("FileType") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("FileUrl") + .HasMaxLength(4000) + .IsUnicode(true) + .HasColumnType("nvarchar(4000)"); + + b.Property("LastStatusChangedOn") + .HasColumnType("datetime2"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("LastUpdatedByIp") + .HasColumnType("nvarchar(max)"); + + b.Property("LastUpdatedByUserId") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Title") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("Url") + .HasMaxLength(4000) + .IsUnicode(true) + .HasColumnType("nvarchar(4000)"); + + b.Property("WebsiteId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WebsiteId"); + + b.ToTable("FileUpload", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Language", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(10) + .IsUnicode(true) + .HasColumnType("nvarchar(10)"); + + b.Property("IsoCode") + .HasMaxLength(20) + .IsUnicode(true) + .HasColumnType("nvarchar(20)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .IsUnicode(true) + .HasColumnType("nvarchar(100)"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.ToTable("Language", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Tag", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedByIp") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatedByUserId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("Title") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.HasKey("Id"); + + b.HasIndex("LangId"); + + b.ToTable("Tag", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Website", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CopyrightText") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("DefaultLangId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("Email") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.Property("IsReadOnly") + .HasColumnType("bit"); + + b.Property("Keywords") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("LastStatusChangedOn") + .HasColumnType("datetime2"); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("LastUpdatedByIp") + .HasColumnType("nvarchar(max)"); + + b.Property("LastUpdatedByUserId") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("OwnerUserId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Password") + .HasMaxLength(100) + .IsUnicode(true) + .HasColumnType("nvarchar(100)"); + + b.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(2); + + b.Property("TemplateName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)") + .HasDefaultValue("default"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("Id"); + + b.ToTable("Website", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.WebsiteTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContentTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagSlug") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("TagTitle") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b.Property("WebsiteId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.HasIndex("ContentTypeId"); + + b.HasIndex("LangId"); + + b.HasIndex("WebsiteId"); + + b.HasIndex("TagId", "WebsiteId", "ContentId") + .IsUnique(); + + b.ToTable("WebsiteTag", (string)null); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Comment", b => + { + b.HasOne("Behlog.Cms.Domain.Content", "Content") + .WithMany() + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Content"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Component", b => + { + b.HasOne("Behlog.Cms.Domain.Language", "Language") + .WithMany() + .HasForeignKey("LangId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Website", "Website") + .WithMany() + .HasForeignKey("WebsiteId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsMany("Behlog.Cms.Domain.ComponentFile", "Files", b1 => + { + b1.Property("ComponentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.Property("FileName") + .IsRequired() + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.Property("Title") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b1.HasKey("ComponentId", "FileId"); + + b1.HasIndex("FileId"); + + b1.ToTable("ComponentFile", (string)null); + + b1.WithOwner() + .HasForeignKey("ComponentId"); + + b1.HasOne("Behlog.Cms.Domain.FileUpload", "File") + .WithMany() + .HasForeignKey("FileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b1.Navigation("File"); + }); + + b.OwnsMany("Behlog.Cms.Domain.ComponentMeta", "Meta", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + + b1.Property("Category") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.Property("Index") + .HasColumnType("int") + .HasColumnName("IndexNumber"); + + b1.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b1.Property("MetaKey") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("MetaType") + .HasColumnType("nvarchar(max)"); + + b1.Property("MetaValue") + .HasMaxLength(4000) + .IsUnicode(true) + .HasColumnType("nvarchar(4000)"); + + b1.Property("OrderNum") + .HasColumnType("int"); + + b1.Property("OwnerId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b1.Property("Title") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.HasKey("Id"); + + b1.HasIndex("OwnerId"); + + b1.ToTable("ComponentMeta", (string)null); + + b1.WithOwner() + .HasForeignKey("OwnerId"); + }); + + b.Navigation("Files"); + + b.Navigation("Language"); + + b.Navigation("Meta"); + + b.Navigation("Website"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Content", b => + { + b.HasOne("Behlog.Cms.Domain.ContentType", "ContentType") + .WithMany() + .HasForeignKey("ContentTypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Language", "Language") + .WithMany() + .HasForeignKey("LangId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsMany("Behlog.Cms.ContentAuthor", "Authors", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + + b1.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("UserId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("Visible") + .HasColumnType("bit"); + + b1.HasKey("Id"); + + b1.HasIndex("ContentId"); + + b1.ToTable("ContentAuthor", (string)null); + + b1.WithOwner() + .HasForeignKey("ContentId"); + }); + + b.OwnsMany("Behlog.Cms.Contents.ContentHistory", "Histories", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + + b1.Property("AltTitle") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b1.Property("Body") + .IsUnicode(true) + .HasColumnType("nTEXT"); + + b1.Property("BodyType") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b1.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("CreatedDate") + .HasColumnType("datetime2"); + + b1.Property("IpAddress") + .HasMaxLength(50) + .IsUnicode(true) + .HasColumnType("nvarchar(50)"); + + b1.Property("Slug") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b1.Property("Summary") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.Property("Title") + .IsRequired() + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b1.Property("UserDisplayName") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("UserId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.Property("UserName") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.HasKey("Id"); + + b1.HasIndex("ContentId"); + + b1.ToTable("ContentHistory", (string)null); + + b1.WithOwner() + .HasForeignKey("ContentId"); + }); + + b.OwnsMany("Behlog.Cms.Domain.ContentComponent", "Components", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + + b1.Property("ComponentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("IsRtl") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b1.Property("OrderNum") + .HasColumnType("int"); + + b1.Property("Params") + .HasMaxLength(4000) + .IsUnicode(true) + .HasColumnType("nvarchar(4000)"); + + b1.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b1.Property("ViewPath") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.HasKey("Id"); + + b1.HasIndex("ComponentId"); + + b1.HasIndex("ContentId"); + + b1.ToTable("ContentComponent", (string)null); + + b1.HasOne("Behlog.Cms.Domain.Component", "Component") + .WithMany() + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b1.WithOwner() + .HasForeignKey("ContentId"); + + b1.Navigation("Component"); + }); + + b.OwnsMany("Behlog.Cms.Domain.ContentFile", "Files", b1 => + { + b1.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.Property("FileName") + .IsRequired() + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.Property("Title") + .HasMaxLength(1000) + .IsUnicode(true) + .HasColumnType("nvarchar(1000)"); + + b1.HasKey("ContentId", "FileId"); + + b1.HasIndex("FileId"); + + b1.ToTable("ContentFile", (string)null); + + b1.WithOwner() + .HasForeignKey("ContentId"); + + b1.HasOne("Behlog.Cms.Domain.FileUpload", "File") + .WithMany() + .HasForeignKey("FileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b1.Navigation("File"); + }); + + b.OwnsMany("Behlog.Cms.Domain.ContentLike", "Likes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + + b1.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("CreatedDate") + .HasColumnType("datetime2"); + + b1.Property("IpAddress") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.Property("SessionId") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b1.Property("UserId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.HasKey("Id"); + + b1.HasIndex("ContentId"); + + b1.ToTable("ContentLike", (string)null); + + b1.WithOwner() + .HasForeignKey("ContentId"); + }); + + b.OwnsMany("Behlog.Cms.Domain.ContentMeta", "Meta", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + + b1.Property("Category") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b1.Property("MetaKey") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("MetaType") + .HasColumnType("nvarchar(max)"); + + b1.Property("MetaValue") + .HasMaxLength(4000) + .IsUnicode(true) + .HasColumnType("nvarchar(4000)"); + + b1.Property("OrderNum") + .HasColumnType("int"); + + b1.Property("OwnerId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b1.Property("Title") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.HasKey("Id"); + + b1.HasIndex("OwnerId"); + + b1.ToTable("ContentMeta", (string)null); + + b1.WithOwner() + .HasForeignKey("OwnerId"); + }); + + b.Navigation("Authors"); + + b.Navigation("Components"); + + b.Navigation("ContentType"); + + b.Navigation("Files"); + + b.Navigation("Histories"); + + b.Navigation("Language"); + + b.Navigation("Likes"); + + b.Navigation("Meta"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentCategory", b => + { + b.HasOne("Behlog.Cms.Domain.ContentType", "ContentType") + .WithMany() + .HasForeignKey("ContentTypeId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Behlog.Cms.Domain.Language", "Language") + .WithMany() + .HasForeignKey("LangId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Website", "Website") + .WithMany() + .HasForeignKey("WebsiteId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ContentType"); + + b.Navigation("Language"); + + b.Navigation("Website"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentCategoryItem", b => + { + b.HasOne("Behlog.Cms.Domain.ContentCategory", "Category") + .WithMany("Contents") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Content", "Content") + .WithMany("Categories") + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + + b.Navigation("Content"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentTag", b => + { + b.HasOne("Behlog.Cms.Domain.Content", "Content") + .WithMany("Tags") + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Tag", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Content"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentType", b => + { + b.HasOne("Behlog.Cms.Domain.Language", "Language") + .WithMany() + .HasForeignKey("LangId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentTypeTag", b => + { + b.HasOne("Behlog.Cms.Domain.ContentType", "ContentType") + .WithMany() + .HasForeignKey("ContentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Language", "Language") + .WithMany() + .HasForeignKey("LangId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Tag", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContentType"); + + b.Navigation("Language"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.FileUpload", b => + { + b.HasOne("Behlog.Cms.Domain.Website", "Website") + .WithMany() + .HasForeignKey("WebsiteId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Website"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Tag", b => + { + b.HasOne("Behlog.Cms.Domain.Language", "Language") + .WithMany() + .HasForeignKey("LangId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Website", b => + { + b.OwnsMany("Behlog.Cms.Domain.WebsiteMeta", "Meta", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"), 1L, 1); + + b1.Property("Category") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("Description") + .HasMaxLength(2000) + .IsUnicode(true) + .HasColumnType("nvarchar(2000)"); + + b1.Property("LangId") + .HasColumnType("uniqueidentifier"); + + b1.Property("MetaKey") + .IsRequired() + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("MetaType") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.Property("MetaValue") + .HasMaxLength(4000) + .IsUnicode(true) + .HasColumnType("nvarchar(4000)"); + + b1.Property("OrderNum") + .HasColumnType("int"); + + b1.Property("OwnerId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Status") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b1.Property("Title") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + + b1.HasKey("Id"); + + b1.HasIndex("OwnerId"); + + b1.ToTable("WebsiteMeta", (string)null); + + b1.WithOwner() + .HasForeignKey("OwnerId"); + }); + + b.Navigation("Meta"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.WebsiteTag", b => + { + b.HasOne("Behlog.Cms.Domain.Content", "Content") + .WithMany() + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.ContentType", "ContentType") + .WithMany() + .HasForeignKey("ContentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Language", "Language") + .WithMany() + .HasForeignKey("LangId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Tag", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Behlog.Cms.Domain.Website", "Website") + .WithMany() + .HasForeignKey("WebsiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Content"); + + b.Navigation("ContentType"); + + b.Navigation("Language"); + + b.Navigation("Tag"); + + b.Navigation("Website"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.Content", b => + { + b.Navigation("Categories"); + + b.Navigation("Tags"); + }); + + modelBuilder.Entity("Behlog.Cms.Domain.ContentCategory", b => + { + b.Navigation("Contents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/20230605162129_FileUpload_ContentType.cs b/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/20230605162129_FileUpload_ContentType.cs new file mode 100644 index 0000000..b450f23 --- /dev/null +++ b/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/20230605162129_FileUpload_ContentType.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Behlog.Cms.EntityFrameworkCore.SqlServer.Migrations +{ + public partial class FileUpload_ContentType : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ContentType", + table: "FileUpload", + type: "nvarchar(256)", + maxLength: 256, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ContentType", + table: "FileUpload"); + } + } +} diff --git a/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/BehlogSqlServerDbContextModelSnapshot.cs b/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/BehlogSqlServerDbContextModelSnapshot.cs index 00132d6..34bdd1e 100644 --- a/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/BehlogSqlServerDbContextModelSnapshot.cs +++ b/src/Behlog.Cms.EntityFrameworkCore.SqlServer/Migrations/BehlogSqlServerDbContextModelSnapshot.cs @@ -560,6 +560,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnicode(true) .HasColumnType("nvarchar(2000)"); + b.Property("ContentType") + .HasMaxLength(256) + .IsUnicode(true) + .HasColumnType("nvarchar(256)"); + b.Property("CreatedByIp") .HasColumnType("nvarchar(max)");