diff --git a/data/Piranha.Data.EF.SQLServer/Migrations/20210406114503_AddContentBlocks.Designer.cs b/data/Piranha.Data.EF.SQLServer/Migrations/20210406114503_AddContentBlocks.Designer.cs new file mode 100644 index 000000000..5c0028651 --- /dev/null +++ b/data/Piranha.Data.EF.SQLServer/Migrations/20210406114503_AddContentBlocks.Designer.cs @@ -0,0 +1,1860 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Piranha.Data.EF.SQLServer; + +namespace Piranha.Data.EF.SQLServer.Migrations +{ + [DbContext(typeof(SQLServerDb))] + [Migration("20210406114503_AddContentBlocks")] + partial class AddContentBlocks + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.0"); + + modelBuilder.Entity("Piranha.Data.Alias", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AliasUrl") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("RedirectUrl") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("SiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SiteId", "AliasUrl") + .IsUnique(); + + b.ToTable("Piranha_Aliases"); + }); + + modelBuilder.Entity("Piranha.Data.Block", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("IsReusable") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Title") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.ToTable("Piranha_Blocks"); + }); + + modelBuilder.Entity("Piranha.Data.BlockField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlockId") + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FieldId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BlockId", "FieldId", "SortOrder") + .IsUnique(); + + b.ToTable("Piranha_BlockFields"); + }); + + modelBuilder.Entity("Piranha.Data.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("BlogId", "Slug") + .IsUnique(); + + b.ToTable("Piranha_Categories"); + }); + + modelBuilder.Entity("Piranha.Data.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CategoryId") + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Excerpt") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("PrimaryImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("TypeId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("TypeId"); + + b.ToTable("Piranha_Content"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.ToTable("Piranha_ContentBlocks"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlockId") + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FieldId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BlockId", "FieldId", "SortOrder") + .IsUnique(); + + b.ToTable("Piranha_ContentBlockFields"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockFieldTranslation", b => + { + b.Property("FieldId") + .HasColumnType("uniqueidentifier"); + + b.Property("LanguageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("FieldId", "LanguageId"); + + b.HasIndex("LanguageId"); + + b.ToTable("Piranha_ContentBlockFieldTranslations"); + }); + + modelBuilder.Entity("Piranha.Data.ContentField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("FieldId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RegionId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ContentId", "RegionId", "FieldId", "SortOrder"); + + b.ToTable("Piranha_ContentFields"); + }); + + modelBuilder.Entity("Piranha.Data.ContentFieldTranslation", b => + { + b.Property("FieldId") + .HasColumnType("uniqueidentifier"); + + b.Property("LanguageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("FieldId", "LanguageId"); + + b.HasIndex("LanguageId"); + + b.ToTable("Piranha_ContentFieldTranslations"); + }); + + modelBuilder.Entity("Piranha.Data.ContentGroup", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Icon") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsHidden") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.ToTable("Piranha_ContentGroups"); + }); + + modelBuilder.Entity("Piranha.Data.ContentTaxonomy", b => + { + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TaxonomyId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("ContentId", "TaxonomyId"); + + b.HasIndex("TaxonomyId"); + + b.ToTable("Piranha_ContentTaxonomies"); + }); + + modelBuilder.Entity("Piranha.Data.ContentTranslation", b => + { + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("LanguageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Excerpt") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("ContentId", "LanguageId"); + + b.HasIndex("LanguageId"); + + b.ToTable("Piranha_ContentTranslations"); + }); + + modelBuilder.Entity("Piranha.Data.ContentType", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Body") + .HasColumnType("nvarchar(max)"); + + b.Property("CLRType") + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("Piranha_ContentTypes"); + }); + + modelBuilder.Entity("Piranha.Data.Language", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Culture") + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.ToTable("Piranha_Languages"); + }); + + modelBuilder.Entity("Piranha.Data.Media", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AltText") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Filename") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("FolderId") + .HasColumnType("uniqueidentifier"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("PublicUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("Title") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FolderId"); + + b.ToTable("Piranha_Media"); + }); + + modelBuilder.Entity("Piranha.Data.MediaFolder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("Piranha_MediaFolders"); + }); + + modelBuilder.Entity("Piranha.Data.MediaVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FileExtension") + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("MediaId") + .HasColumnType("uniqueidentifier"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("MediaId", "Width", "Height") + .IsUnique() + .HasFilter("[Height] IS NOT NULL"); + + b.ToTable("Piranha_MediaVersions"); + }); + + modelBuilder.Entity("Piranha.Data.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CloseCommentsAfterDays") + .HasColumnType("int"); + + b.Property("ContentType") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)") + .HasDefaultValue("Page"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("EnableComments") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("Excerpt") + .HasColumnType("nvarchar(max)"); + + b.Property("IsHidden") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("MetaDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("MetaFollow") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("MetaIndex") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("MetaKeywords") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("MetaPriority") + .ValueGeneratedOnAdd() + .HasColumnType("float") + .HasDefaultValue(0.5); + + b.Property("MetaTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("NavigationTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("OgDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("OgImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("OgTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("OriginalPageId") + .HasColumnType("uniqueidentifier"); + + b.Property("PageTypeId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("PrimaryImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Published") + .HasColumnType("datetime2"); + + b.Property("RedirectType") + .HasColumnType("int"); + + b.Property("RedirectUrl") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Route") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("SiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("PageTypeId"); + + b.HasIndex("ParentId"); + + b.HasIndex("SiteId", "Slug") + .IsUnique(); + + b.ToTable("Piranha_Pages"); + }); + + modelBuilder.Entity("Piranha.Data.PageBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlockId") + .HasColumnType("uniqueidentifier"); + + b.Property("PageId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BlockId"); + + b.HasIndex("PageId", "SortOrder") + .IsUnique(); + + b.ToTable("Piranha_PageBlocks"); + }); + + modelBuilder.Entity("Piranha.Data.PageComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Author") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Body") + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("PageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("UserId") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("PageId"); + + b.ToTable("Piranha_PageComments"); + }); + + modelBuilder.Entity("Piranha.Data.PageField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FieldId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PageId") + .HasColumnType("uniqueidentifier"); + + b.Property("RegionId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("PageId", "RegionId", "FieldId", "SortOrder"); + + b.ToTable("Piranha_PageFields"); + }); + + modelBuilder.Entity("Piranha.Data.PagePermission", b => + { + b.Property("PageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Permission") + .HasColumnType("nvarchar(450)"); + + b.HasKey("PageId", "Permission"); + + b.ToTable("Piranha_PagePermissions"); + }); + + modelBuilder.Entity("Piranha.Data.PageRevision", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("PageId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PageId"); + + b.ToTable("Piranha_PageRevisions"); + }); + + modelBuilder.Entity("Piranha.Data.PageType", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Body") + .HasColumnType("nvarchar(max)"); + + b.Property("CLRType") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("Piranha_PageTypes"); + }); + + modelBuilder.Entity("Piranha.Data.Param", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Key") + .IsUnique(); + + b.ToTable("Piranha_Params"); + }); + + modelBuilder.Entity("Piranha.Data.Post", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("CategoryId") + .HasColumnType("uniqueidentifier"); + + b.Property("CloseCommentsAfterDays") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("EnableComments") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("Excerpt") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("MetaDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("MetaFollow") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("MetaIndex") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("MetaKeywords") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("MetaPriority") + .ValueGeneratedOnAdd() + .HasColumnType("float") + .HasDefaultValue(0.5); + + b.Property("MetaTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("OgDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("OgImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("OgTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PostTypeId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PrimaryImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Published") + .HasColumnType("datetime2"); + + b.Property("RedirectType") + .HasColumnType("int"); + + b.Property("RedirectUrl") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Route") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("PostTypeId"); + + b.HasIndex("BlogId", "Slug") + .IsUnique(); + + b.ToTable("Piranha_Posts"); + }); + + modelBuilder.Entity("Piranha.Data.PostBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlockId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("PostId") + .HasColumnType("uniqueidentifier"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BlockId"); + + b.HasIndex("PostId", "SortOrder") + .IsUnique(); + + b.ToTable("Piranha_PostBlocks"); + }); + + modelBuilder.Entity("Piranha.Data.PostComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Author") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Body") + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("PostId") + .HasColumnType("uniqueidentifier"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("UserId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("PostId"); + + b.ToTable("Piranha_PostComments"); + }); + + modelBuilder.Entity("Piranha.Data.PostField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FieldId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PostId") + .HasColumnType("uniqueidentifier"); + + b.Property("RegionId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("PostId", "RegionId", "FieldId", "SortOrder"); + + b.ToTable("Piranha_PostFields"); + }); + + modelBuilder.Entity("Piranha.Data.PostPermission", b => + { + b.Property("PostId") + .HasColumnType("uniqueidentifier"); + + b.Property("Permission") + .HasColumnType("nvarchar(450)"); + + b.HasKey("PostId", "Permission"); + + b.ToTable("Piranha_PostPermissions"); + }); + + modelBuilder.Entity("Piranha.Data.PostRevision", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("PostId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PostId"); + + b.ToTable("Piranha_PostRevisions"); + }); + + modelBuilder.Entity("Piranha.Data.PostTag", b => + { + b.Property("PostId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("PostId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("Piranha_PostTags"); + }); + + modelBuilder.Entity("Piranha.Data.PostType", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Body") + .HasColumnType("nvarchar(max)"); + + b.Property("CLRType") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("Piranha_PostTypes"); + }); + + modelBuilder.Entity("Piranha.Data.Site", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ContentLastModified") + .HasColumnType("datetime2"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Culture") + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Hostnames") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("InternalId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("LanguageId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LogoId") + .HasColumnType("uniqueidentifier"); + + b.Property("SiteTypeId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Title") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("InternalId") + .IsUnique(); + + b.HasIndex("LanguageId"); + + b.ToTable("Piranha_Sites"); + }); + + modelBuilder.Entity("Piranha.Data.SiteField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FieldId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RegionId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("SiteId", "RegionId", "FieldId", "SortOrder"); + + b.ToTable("Piranha_SiteFields"); + }); + + modelBuilder.Entity("Piranha.Data.SiteType", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Body") + .HasColumnType("nvarchar(max)"); + + b.Property("CLRType") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("Piranha_SiteTypes"); + }); + + modelBuilder.Entity("Piranha.Data.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("BlogId", "Slug") + .IsUnique(); + + b.ToTable("Piranha_Tags"); + }); + + modelBuilder.Entity("Piranha.Data.Taxonomy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("GroupId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GroupId", "Type", "Slug") + .IsUnique(); + + b.ToTable("Piranha_Taxonomies"); + }); + + modelBuilder.Entity("Piranha.Data.Alias", b => + { + b.HasOne("Piranha.Data.Site", "Site") + .WithMany() + .HasForeignKey("SiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Site"); + }); + + modelBuilder.Entity("Piranha.Data.BlockField", b => + { + b.HasOne("Piranha.Data.Block", "Block") + .WithMany("Fields") + .HasForeignKey("BlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Block"); + }); + + modelBuilder.Entity("Piranha.Data.Category", b => + { + b.HasOne("Piranha.Data.Page", "Blog") + .WithMany() + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Piranha.Data.Content", b => + { + b.HasOne("Piranha.Data.Taxonomy", "Category") + .WithMany() + .HasForeignKey("CategoryId"); + + b.HasOne("Piranha.Data.ContentType", "Type") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlock", b => + { + b.HasOne("Piranha.Data.Content", "Content") + .WithMany("Blocks") + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Content"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockField", b => + { + b.HasOne("Piranha.Data.ContentBlock", "Block") + .WithMany("Fields") + .HasForeignKey("BlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Block"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockFieldTranslation", b => + { + b.HasOne("Piranha.Data.ContentBlockField", "Field") + .WithMany("Translations") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Language", "Language") + .WithMany() + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Field"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Piranha.Data.ContentField", b => + { + b.HasOne("Piranha.Data.Content", "Content") + .WithMany("Fields") + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Content"); + }); + + modelBuilder.Entity("Piranha.Data.ContentFieldTranslation", b => + { + b.HasOne("Piranha.Data.ContentField", "Field") + .WithMany("Translations") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Language", "Language") + .WithMany() + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Field"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Piranha.Data.ContentTaxonomy", b => + { + b.HasOne("Piranha.Data.Content", "Content") + .WithMany("Tags") + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Taxonomy", "Taxonomy") + .WithMany() + .HasForeignKey("TaxonomyId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Content"); + + b.Navigation("Taxonomy"); + }); + + modelBuilder.Entity("Piranha.Data.ContentTranslation", b => + { + b.HasOne("Piranha.Data.Content", "Content") + .WithMany("Translations") + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Language", "Language") + .WithMany() + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Content"); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Piranha.Data.Media", b => + { + b.HasOne("Piranha.Data.MediaFolder", "Folder") + .WithMany("Media") + .HasForeignKey("FolderId"); + + b.Navigation("Folder"); + }); + + modelBuilder.Entity("Piranha.Data.MediaVersion", b => + { + b.HasOne("Piranha.Data.Media", "Media") + .WithMany("Versions") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("Piranha.Data.Page", b => + { + b.HasOne("Piranha.Data.PageType", "PageType") + .WithMany() + .HasForeignKey("PageTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Page", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("Piranha.Data.Site", "Site") + .WithMany() + .HasForeignKey("SiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PageType"); + + b.Navigation("Parent"); + + b.Navigation("Site"); + }); + + modelBuilder.Entity("Piranha.Data.PageBlock", b => + { + b.HasOne("Piranha.Data.Block", "Block") + .WithMany() + .HasForeignKey("BlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Page", "Page") + .WithMany("Blocks") + .HasForeignKey("PageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Block"); + + b.Navigation("Page"); + }); + + modelBuilder.Entity("Piranha.Data.PageComment", b => + { + b.HasOne("Piranha.Data.Page", "Page") + .WithMany() + .HasForeignKey("PageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Page"); + }); + + modelBuilder.Entity("Piranha.Data.PageField", b => + { + b.HasOne("Piranha.Data.Page", "Page") + .WithMany("Fields") + .HasForeignKey("PageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Page"); + }); + + modelBuilder.Entity("Piranha.Data.PagePermission", b => + { + b.HasOne("Piranha.Data.Page", "Page") + .WithMany("Permissions") + .HasForeignKey("PageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Page"); + }); + + modelBuilder.Entity("Piranha.Data.PageRevision", b => + { + b.HasOne("Piranha.Data.Page", "Page") + .WithMany() + .HasForeignKey("PageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Page"); + }); + + modelBuilder.Entity("Piranha.Data.Post", b => + { + b.HasOne("Piranha.Data.Page", "Blog") + .WithMany() + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Category", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Piranha.Data.PostType", "PostType") + .WithMany() + .HasForeignKey("PostTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + + b.Navigation("Category"); + + b.Navigation("PostType"); + }); + + modelBuilder.Entity("Piranha.Data.PostBlock", b => + { + b.HasOne("Piranha.Data.Block", "Block") + .WithMany() + .HasForeignKey("BlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Post", "Post") + .WithMany("Blocks") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Block"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("Piranha.Data.PostComment", b => + { + b.HasOne("Piranha.Data.Post", "Post") + .WithMany() + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("Piranha.Data.PostField", b => + { + b.HasOne("Piranha.Data.Post", "Post") + .WithMany("Fields") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("Piranha.Data.PostPermission", b => + { + b.HasOne("Piranha.Data.Post", "Post") + .WithMany("Permissions") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("Piranha.Data.PostRevision", b => + { + b.HasOne("Piranha.Data.Post", "Post") + .WithMany() + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("Piranha.Data.PostTag", b => + { + b.HasOne("Piranha.Data.Post", "Post") + .WithMany("Tags") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Tag", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Post"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Piranha.Data.Site", b => + { + b.HasOne("Piranha.Data.Language", "Language") + .WithMany() + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Language"); + }); + + modelBuilder.Entity("Piranha.Data.SiteField", b => + { + b.HasOne("Piranha.Data.Site", "Site") + .WithMany("Fields") + .HasForeignKey("SiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Site"); + }); + + modelBuilder.Entity("Piranha.Data.Tag", b => + { + b.HasOne("Piranha.Data.Page", "Blog") + .WithMany() + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Piranha.Data.Block", b => + { + b.Navigation("Fields"); + }); + + modelBuilder.Entity("Piranha.Data.Content", b => + { + b.Navigation("Blocks"); + + b.Navigation("Fields"); + + b.Navigation("Tags"); + + b.Navigation("Translations"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlock", b => + { + b.Navigation("Fields"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockField", b => + { + b.Navigation("Translations"); + }); + + modelBuilder.Entity("Piranha.Data.ContentField", b => + { + b.Navigation("Translations"); + }); + + modelBuilder.Entity("Piranha.Data.Media", b => + { + b.Navigation("Versions"); + }); + + modelBuilder.Entity("Piranha.Data.MediaFolder", b => + { + b.Navigation("Media"); + }); + + modelBuilder.Entity("Piranha.Data.Page", b => + { + b.Navigation("Blocks"); + + b.Navigation("Fields"); + + b.Navigation("Permissions"); + }); + + modelBuilder.Entity("Piranha.Data.Post", b => + { + b.Navigation("Blocks"); + + b.Navigation("Fields"); + + b.Navigation("Permissions"); + + b.Navigation("Tags"); + }); + + modelBuilder.Entity("Piranha.Data.Site", b => + { + b.Navigation("Fields"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/data/Piranha.Data.EF.SQLServer/Migrations/20210406114503_AddContentBlocks.cs b/data/Piranha.Data.EF.SQLServer/Migrations/20210406114503_AddContentBlocks.cs new file mode 100644 index 000000000..e9dbf49c5 --- /dev/null +++ b/data/Piranha.Data.EF.SQLServer/Migrations/20210406114503_AddContentBlocks.cs @@ -0,0 +1,118 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Piranha.Data.EF.SQLServer.Migrations +{ + public partial class AddContentBlocks : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsHidden", + table: "Piranha_ContentGroups", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "Piranha_ContentBlocks", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ContentId = table.Column(type: "uniqueidentifier", nullable: false), + SortOrder = table.Column(type: "int", nullable: false), + ParentId = table.Column(type: "uniqueidentifier", nullable: true), + CLRType = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Piranha_ContentBlocks", x => x.Id); + table.ForeignKey( + name: "FK_Piranha_ContentBlocks_Piranha_Content_ContentId", + column: x => x.ContentId, + principalTable: "Piranha_Content", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Piranha_ContentBlockFields", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + BlockId = table.Column(type: "uniqueidentifier", nullable: false), + FieldId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + SortOrder = table.Column(type: "int", nullable: false), + CLRType = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Value = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Piranha_ContentBlockFields", x => x.Id); + table.ForeignKey( + name: "FK_Piranha_ContentBlockFields_Piranha_ContentBlocks_BlockId", + column: x => x.BlockId, + principalTable: "Piranha_ContentBlocks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Piranha_ContentBlockFieldTranslations", + columns: table => new + { + FieldId = table.Column(type: "uniqueidentifier", nullable: false), + LanguageId = table.Column(type: "uniqueidentifier", nullable: false), + Value = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Piranha_ContentBlockFieldTranslations", x => new { x.FieldId, x.LanguageId }); + table.ForeignKey( + name: "FK_Piranha_ContentBlockFieldTranslations_Piranha_ContentBlockFields_FieldId", + column: x => x.FieldId, + principalTable: "Piranha_ContentBlockFields", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Piranha_ContentBlockFieldTranslations_Piranha_Languages_LanguageId", + column: x => x.LanguageId, + principalTable: "Piranha_Languages", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Piranha_ContentBlockFields_BlockId_FieldId_SortOrder", + table: "Piranha_ContentBlockFields", + columns: new[] { "BlockId", "FieldId", "SortOrder" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Piranha_ContentBlockFieldTranslations_LanguageId", + table: "Piranha_ContentBlockFieldTranslations", + column: "LanguageId"); + + migrationBuilder.CreateIndex( + name: "IX_Piranha_ContentBlocks_ContentId", + table: "Piranha_ContentBlocks", + column: "ContentId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Piranha_ContentBlockFieldTranslations"); + + migrationBuilder.DropTable( + name: "Piranha_ContentBlockFields"); + + migrationBuilder.DropTable( + name: "Piranha_ContentBlocks"); + + migrationBuilder.DropColumn( + name: "IsHidden", + table: "Piranha_ContentGroups"); + } + } +} diff --git a/data/Piranha.Data.EF.SQLServer/Migrations/DbModelSnapshot.cs b/data/Piranha.Data.EF.SQLServer/Migrations/DbModelSnapshot.cs index 1de8f5d7b..f95dba345 100644 --- a/data/Piranha.Data.EF.SQLServer/Migrations/DbModelSnapshot.cs +++ b/data/Piranha.Data.EF.SQLServer/Migrations/DbModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder .UseIdentityColumns() .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); + .HasAnnotation("ProductVersion", "5.0.0"); modelBuilder.Entity("Piranha.Data.Alias", b => { @@ -191,6 +191,84 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Piranha_Content"); }); + modelBuilder.Entity("Piranha.Data.ContentBlock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ContentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.ToTable("Piranha_ContentBlocks"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlockId") + .HasColumnType("uniqueidentifier"); + + b.Property("CLRType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FieldId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BlockId", "FieldId", "SortOrder") + .IsUnique(); + + b.ToTable("Piranha_ContentBlockFields"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockFieldTranslation", b => + { + b.Property("FieldId") + .HasColumnType("uniqueidentifier"); + + b.Property("LanguageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("FieldId", "LanguageId"); + + b.HasIndex("LanguageId"); + + b.ToTable("Piranha_ContentBlockFieldTranslations"); + }); + modelBuilder.Entity("Piranha.Data.ContentField", b => { b.Property("Id") @@ -264,6 +342,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(64) .HasColumnType("nvarchar(64)"); + b.Property("IsHidden") + .HasColumnType("bit"); + b.Property("LastModified") .HasColumnType("datetime2"); @@ -1348,6 +1429,47 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Type"); }); + modelBuilder.Entity("Piranha.Data.ContentBlock", b => + { + b.HasOne("Piranha.Data.Content", "Content") + .WithMany("Blocks") + .HasForeignKey("ContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Content"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockField", b => + { + b.HasOne("Piranha.Data.ContentBlock", "Block") + .WithMany("Fields") + .HasForeignKey("BlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Block"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockFieldTranslation", b => + { + b.HasOne("Piranha.Data.ContentBlockField", "Field") + .WithMany("Translations") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Piranha.Data.Language", "Language") + .WithMany() + .HasForeignKey("LanguageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Field"); + + b.Navigation("Language"); + }); + modelBuilder.Entity("Piranha.Data.ContentField", b => { b.HasOne("Piranha.Data.Content", "Content") @@ -1672,6 +1794,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Piranha.Data.Content", b => { + b.Navigation("Blocks"); + b.Navigation("Fields"); b.Navigation("Tags"); @@ -1679,6 +1803,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Translations"); }); + modelBuilder.Entity("Piranha.Data.ContentBlock", b => + { + b.Navigation("Fields"); + }); + + modelBuilder.Entity("Piranha.Data.ContentBlockField", b => + { + b.Navigation("Translations"); + }); + modelBuilder.Entity("Piranha.Data.ContentField", b => { b.Navigation("Translations");