From d9ab9e2855f2917c14aaeded8e1dab5d686e3fe2 Mon Sep 17 00:00:00 2001 From: Mark Appleton Date: Fri, 24 Jan 2025 09:02:00 +0000 Subject: [PATCH 01/11] start of adding scripts directly to page --- .../Views/Page/Development.cshtml | 14 ++- .../Blog/Post.cs | 2 +- .../IContentItem.cs | 2 +- .../Page/Page.cs | 1 + .../Page/PageResource.cs | 4 +- .../Models/PageEntity.cs | 1 + .../Models/PageResourceEntity.cs | 4 +- .../Models/PostEntity.cs | 2 +- .../YamlPage.cs | 3 + .../YamlPost.cs | 4 +- .../Controllers/PageController.cs | 95 +++++++++++++++---- .../Services/Page/PageEditContextRequest.cs | 3 + .../ViewModels/AddPageResourceViewModel.cs | 7 ++ .../ViewModels/PageDevelopmentViewModel.cs | 2 +- .../page/test-2.json | 2 +- .../17595de8-d27a-4304-bded-76b61a16ad19.json | 2 +- 16 files changed, 116 insertions(+), 32 deletions(-) diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml index 73dffbe02..a536b7bb3 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml @@ -65,9 +65,17 @@ +
+
+ + + + +
+ +
+ @section Scripts { - -} - +} \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.Models/Blog/Post.cs b/src/cloudscribe.SimpleContent.Models/Blog/Post.cs index f79bfca05..5374bd3f2 100644 --- a/src/cloudscribe.SimpleContent.Models/Blog/Post.cs +++ b/src/cloudscribe.SimpleContent.Models/Blog/Post.cs @@ -96,6 +96,6 @@ public static Post FromIPost(IPost post) post.CopyTo(p); return p; } - + public string Script { get; set; } } } diff --git a/src/cloudscribe.SimpleContent.Models/IContentItem.cs b/src/cloudscribe.SimpleContent.Models/IContentItem.cs index 1119f5f4c..3a3c31e7a 100644 --- a/src/cloudscribe.SimpleContent.Models/IContentItem.cs +++ b/src/cloudscribe.SimpleContent.Models/IContentItem.cs @@ -11,6 +11,6 @@ public interface IContentItem string Content { get; set; } DateTime? PubDate { get; set; } string MetaDescription { get; set; } - + string Script { get; set; } } } diff --git a/src/cloudscribe.SimpleContent.Models/Page/Page.cs b/src/cloudscribe.SimpleContent.Models/Page/Page.cs index e0635151c..d05cbb6ec 100644 --- a/src/cloudscribe.SimpleContent.Models/Page/Page.cs +++ b/src/cloudscribe.SimpleContent.Models/Page/Page.cs @@ -101,5 +101,6 @@ public static Page FromIPage(IPage page) public bool? ShowCreatedDate { get; set; } public bool? ShowLastModifiedBy { get; set; } public bool? ShowLastModifiedDate { get; set; } + public string Script { get; set; } } } diff --git a/src/cloudscribe.SimpleContent.Models/Page/PageResource.cs b/src/cloudscribe.SimpleContent.Models/Page/PageResource.cs index 84f264439..0c7569c81 100644 --- a/src/cloudscribe.SimpleContent.Models/Page/PageResource.cs +++ b/src/cloudscribe.SimpleContent.Models/Page/PageResource.cs @@ -19,6 +19,7 @@ public interface IPageResource /// string Environment { get; set; } string Url { get; set; } + string Script { get; set; } } public class PageResource : IPageResource @@ -31,10 +32,10 @@ public PageResource() public string Id { get; set; } public string ContentId { get; set; } public int Sort { get; set; } = 1; - public string Type { get; set; } public string Environment { get; set; } public string Url { get; set; } + public string Script { get; set; } public static PageResource FromIPageResource(IPageResource r) { @@ -45,6 +46,7 @@ public static PageResource FromIPageResource(IPageResource r) resource.Sort = r.Sort; resource.Type = r.Type; resource.Url = r.Url; + resource.Script = r.Script; return resource; diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageEntity.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageEntity.cs index bdc732b18..02cc3bb38 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageEntity.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageEntity.cs @@ -233,5 +233,6 @@ public static PageEntity FromIPage(IPage page) public bool? ShowCreatedDate { get; set; } public bool? ShowLastModifiedBy { get; set; } public bool? ShowLastModifiedDate { get; set; } + public string Script { get; set; } } } diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageResourceEntity.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageResourceEntity.cs index 6de77246e..027d6cef7 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageResourceEntity.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageResourceEntity.cs @@ -24,12 +24,11 @@ public string PageEntityId get { return pageEntityId; } set { pageEntityId = value; } } - public int Sort { get; set; } = 1; - public string Type { get; set; } public string Environment { get; set; } public string Url { get; set; } + public string Script { get; set; } public static PageResourceEntity FromIPageResource(IPageResource r) { @@ -40,6 +39,7 @@ public static PageResourceEntity FromIPageResource(IPageResource r) resource.Sort = r.Sort; resource.Type = r.Type; resource.Url = r.Url; + resource.Script = r.Script; return resource; diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PostEntity.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PostEntity.cs index 7e4bfbcab..3feae1ad9 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PostEntity.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PostEntity.cs @@ -136,6 +136,6 @@ public static PostEntity FromIPost(IPost post) post.CopyTo(p); return p; } - + public string Script { get; set; } } } diff --git a/src/cloudscribe.SimpleContent.Storage.NoDb/YamlPage.cs b/src/cloudscribe.SimpleContent.Storage.NoDb/YamlPage.cs index a9b8ff295..1d0215685 100644 --- a/src/cloudscribe.SimpleContent.Storage.NoDb/YamlPage.cs +++ b/src/cloudscribe.SimpleContent.Storage.NoDb/YamlPage.cs @@ -149,6 +149,9 @@ public YamlPage() [YamlMember(Order = 43)] public bool? ShowLastModifiedDate { get; set; } + [YamlMember(Order = 44)] + public string Script { get; set; } = string.Empty; + [YamlIgnore] public string Content { get; set; } = string.Empty; [YamlIgnore] diff --git a/src/cloudscribe.SimpleContent.Storage.NoDb/YamlPost.cs b/src/cloudscribe.SimpleContent.Storage.NoDb/YamlPost.cs index 4875b828b..644d57d20 100644 --- a/src/cloudscribe.SimpleContent.Storage.NoDb/YamlPost.cs +++ b/src/cloudscribe.SimpleContent.Storage.NoDb/YamlPost.cs @@ -103,8 +103,8 @@ public YamlPost() [YamlMember(Order = 30)] public bool ShowComments { get; set; } = true; - - + [YamlMember(Order = 31)] + public string Script { get; set; } = string.Empty; [YamlIgnore] public List Comments { get; set; } diff --git a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs index 533df83a3..6a6f8f51c 100644 --- a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs +++ b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Org.BouncyCastle.Asn1.Cmp; using System; using System.Collections.Generic; using System.Globalization; @@ -266,7 +267,7 @@ public virtual async Task NewPage( int pageSize = 10 ) { - var editContextRequest = new PageEditContextRequest(User, null, null, null); + var editContextRequest = new PageEditContextRequest(User, null, null, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) @@ -476,7 +477,7 @@ protected virtual async Task EditWithTemplate(CancellationToken c [ValidateAntiForgeryToken] public virtual async Task EditWithTemplate(PageEditWithTemplateViewModel model) { - var editContextRequest = new PageEditContextRequest(User, null, model.Id, null); + var editContextRequest = new PageEditContextRequest(User, null, model.Id, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) @@ -557,7 +558,7 @@ public virtual async Task Edit( Guid? historyId = null ) { - var request = new PageEditContextRequest(User, slug, null, historyId); + var request = new PageEditContextRequest(User, slug, null, null, historyId); var editContext = await Mediator.Send(request); if(!editContext.IsValidRequest) { @@ -715,7 +716,7 @@ public virtual async Task Edit( [ValidateAntiForgeryToken] public virtual async Task Edit(PageEditViewModel model) { - var editContextRequest = new PageEditContextRequest(User, null, model.Id, null); + var editContextRequest = new PageEditContextRequest(User, null, model.Id, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) @@ -805,11 +806,9 @@ public virtual async Task Edit(PageEditViewModel model) [HttpGet] [AllowAnonymous] - public virtual async Task Development( - CancellationToken cancellationToken, - string slug) + public virtual async Task Development(CancellationToken cancellationToken, string slug, string script) { - var editContextRequest = new PageEditContextRequest(User, slug, null, null); + var editContextRequest = new PageEditContextRequest(User, slug, null, script, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -844,9 +843,11 @@ public virtual async Task Development( var model = new PageDevelopmentViewModel { - Slug = editContext.CurrentPage.Slug + Slug = editContext.CurrentPage.Slug, + Script = editContext.CurrentPage.Script }; model.AddResourceViewModel.Slug = editContext.CurrentPage.Slug; + model.AddResourceViewModel.Script = editContext.CurrentPage.Script; model.Css = editContext.CurrentPage.Resources.Where(x => x.Type == "css").OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList(); model.Js = editContext.CurrentPage.Resources.Where(x => x.Type == "js").OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList(); @@ -859,7 +860,7 @@ public virtual async Task Development( [ValidateAntiForgeryToken] public virtual async Task AddResource(AddPageResourceViewModel model) { - var editContextRequest = new PageEditContextRequest(User, model.Slug, null, null); + var editContextRequest = new PageEditContextRequest(User, model.Slug, null, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -910,12 +911,70 @@ public virtual async Task AddResource(AddPageResourceViewModel mo return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = editContext.CurrentPage.Slug }); } + [HttpPost] + [AllowAnonymous] + [ValidateAntiForgeryToken] + public virtual async Task AddScriptResource(AddPageResourceViewModelScriptOnly model) + { + var editContextRequest = new PageEditContextRequest(User, model.Slug, null, model.Script, null); + var editContext = await Mediator.Send(editContextRequest); + var canDev = EditOptions.AlwaysShowDeveloperLink ? true : User.IsInRole(EditOptions.DeveloperAllowedRole); + + if (!editContext.IsValidRequest) + { + Log.LogInformation("redirecting to index because project settings not found"); + return RedirectToRoute(PageRoutes.PageRouteName, new { slug = "" }); + } + + if (string.IsNullOrEmpty(model.Script)) + { + this.AlertDanger(StringLocalizer["Invalid request"], true); + return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = model.Slug }); + } + + if (!ModelState.IsValid) + { } + + if (!canDev) + { + Log.LogInformation("redirecting to index because user is not allowed by edit config for developer tools"); + return RedirectToRoute(PageRoutes.PageRouteName); + } + + if (editContext.CurrentPage == null) + { + Log.LogInformation("page not found, redirecting"); + return RedirectToRoute(PageRoutes.PageRouteName, new { slug = "" }); + } + + if ((!string.IsNullOrEmpty(editContext.CurrentPage.ViewRoles))) + { + if (!User.IsInRoles(editContext.CurrentPage.ViewRoles)) + { + Log.LogWarning($"page {editContext.CurrentPage.Title} is protected by roles that user is not in so redirecting"); + return RedirectToRoute(PageRoutes.PageRouteName, new { slug = "" }); + } + } + + //var resource = new PageResource + //{ + // Script = model.Script + //}; + //editContext.CurrentPage.Resources.Add(resource); + + editContext.CurrentPage.Script = model.Script; + + await PageService.Update(editContext.CurrentPage); + + return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = editContext.CurrentPage.Slug }); + } + [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public virtual async Task RemoveResource(string slug, string id) { - var editContextRequest = new PageEditContextRequest(User, slug, null, null); + var editContextRequest = new PageEditContextRequest(User, slug, null, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -976,7 +1035,7 @@ public virtual async Task RemoveResource(string slug, string id) [ValidateAntiForgeryToken] public virtual async Task Delete(string id) { - var editContextRequest = new PageEditContextRequest(User, null, id, null); + var editContextRequest = new PageEditContextRequest(User, null, id, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -1065,7 +1124,7 @@ public virtual async Task UnPublish(string id) return RedirectToRoute(PageRoutes.PageRouteName, new { slug = "" }); } - var editContextRequest = new PageEditContextRequest(User, null, id, null); + var editContextRequest = new PageEditContextRequest(User, null, id, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -1140,7 +1199,7 @@ public virtual async Task UnPublish(string id) [ValidateAntiForgeryToken] public async Task DeleteHistoryOlderThan(string id, int days) { - var editContextRequest = new PageEditContextRequest(User, null, id, null); + var editContextRequest = new PageEditContextRequest(User, null, id, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -1177,7 +1236,7 @@ public virtual IActionResult SiteMap() public virtual async Task Tree() { - var editContextRequest = new PageEditContextRequest(User, null, null, null); + var editContextRequest = new PageEditContextRequest(User, null, null, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -1204,7 +1263,7 @@ public virtual async Task Tree() [AllowAnonymous] public virtual async Task TreeJson(CancellationToken cancellationToken, string node = "root") { - var editContextRequest = new PageEditContextRequest(User, null, null, null); + var editContextRequest = new PageEditContextRequest(User, null, null, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -1244,7 +1303,7 @@ public virtual async Task Move(PageMoveModel model) return BadRequest(); } - var editContextRequest = new PageEditContextRequest(User, null, null, null); + var editContextRequest = new PageEditContextRequest(User, null, null, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { @@ -1263,7 +1322,7 @@ public virtual async Task Move(PageMoveModel model) [ValidateAntiForgeryToken] public virtual async Task SortChildPagesAlpha(string pageId) { - var editContextRequest = new PageEditContextRequest(User, null, null, null); + var editContextRequest = new PageEditContextRequest(User, null, null, null, null); var editContext = await Mediator.Send(editContextRequest); if (!editContext.IsValidRequest) { diff --git a/src/cloudscribe.SimpleContent.Web/Services/Page/PageEditContextRequest.cs b/src/cloudscribe.SimpleContent.Web/Services/Page/PageEditContextRequest.cs index 84714755a..9363450f3 100644 --- a/src/cloudscribe.SimpleContent.Web/Services/Page/PageEditContextRequest.cs +++ b/src/cloudscribe.SimpleContent.Web/Services/Page/PageEditContextRequest.cs @@ -10,6 +10,7 @@ public PageEditContextRequest( ClaimsPrincipal user, string slug, string pageId, + string script, Guid? historyId ) { @@ -17,10 +18,12 @@ public PageEditContextRequest( Slug = slug; PageId = pageId; HistoryId = historyId; + Script = script; } public ClaimsPrincipal User { get; private set; } public string Slug { get; private set; } + public string Script { get; private set; } public string PageId { get; private set; } public Guid? HistoryId { get; private set; } } diff --git a/src/cloudscribe.SimpleContent.Web/ViewModels/AddPageResourceViewModel.cs b/src/cloudscribe.SimpleContent.Web/ViewModels/AddPageResourceViewModel.cs index 0748d4d69..c37a73551 100644 --- a/src/cloudscribe.SimpleContent.Web/ViewModels/AddPageResourceViewModel.cs +++ b/src/cloudscribe.SimpleContent.Web/ViewModels/AddPageResourceViewModel.cs @@ -18,5 +18,12 @@ public class AddPageResourceViewModel //[DataType(DataType.Url)] [RegularExpression(@"^(http(s)?://)?(\/?)[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-‌​\.\?\,\'\/\\\+&%\$#_]*)?$", ErrorMessage ="Please provide a valid url or relative url")] public string Url { get; set; } + public string Script { get; set; } + } + + public class AddPageResourceViewModelScriptOnly + { + public string Slug { get; set; } + public string Script { get; set; } } } diff --git a/src/cloudscribe.SimpleContent.Web/ViewModels/PageDevelopmentViewModel.cs b/src/cloudscribe.SimpleContent.Web/ViewModels/PageDevelopmentViewModel.cs index 34f81924c..57e10ea84 100644 --- a/src/cloudscribe.SimpleContent.Web/ViewModels/PageDevelopmentViewModel.cs +++ b/src/cloudscribe.SimpleContent.Web/ViewModels/PageDevelopmentViewModel.cs @@ -13,7 +13,7 @@ public PageDevelopmentViewModel() } public string Slug { get; set; } = string.Empty; - + public string Script { get; set; } = string.Empty; public List Css { get; set; } public List Js { get; set; } diff --git a/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/test-2.json b/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/test-2.json index 2ac93f7d0..1ee7fe99f 100644 --- a/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/test-2.json +++ b/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/test-2.json @@ -1 +1 @@ -{"Id":"test-2","ProjectId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","ParentId":"0","ParentSlug":"","PageOrder":23,"Title":"test 123","Author":"Admin","Slug":"test-2","ExternalUrl":null,"CorrelationKey":null,"MetaDescription":null,"MetaJson":null,"MetaHtml":null,"Content":"

testing, testing, 123

\r\n","PubDate":"2024-12-13T08:56:01.33245Z","LastModified":"2024-12-13T08:56:21.0955713Z","IsPublished":true,"MenuOnly":false,"ShowMenu":false,"ViewRoles":null,"Categories":[],"Comments":[],"ShowHeading":true,"ShowPubDate":false,"ShowLastModified":false,"ShowCategories":false,"ShowComments":false,"MenuFilters":null,"DisableEditor":false,"Resources":[],"ContentType":"html","CreatedUtc":"2024-12-13T08:56:01.3305956Z","CreatedByUser":"admin","LastModifiedByUser":"admin","DraftContent":null,"DraftAuthor":null,"DraftPubDate":null,"TemplateKey":null,"SerializedModel":null,"DraftSerializedModel":null,"Serializer":null,"ShowCreatedBy":null,"ShowCreatedDate":null,"ShowLastModifiedBy":null,"ShowLastModifiedDate":null} \ No newline at end of file +{"Id":"test-2","ProjectId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","ParentId":"0","ParentSlug":"","PageOrder":23,"Title":"test 123","Author":"Admin","Slug":"test-2","ExternalUrl":null,"CorrelationKey":null,"MetaDescription":null,"MetaJson":null,"MetaHtml":null,"Content":"

testing, testing, 123

\r\n","PubDate":"2024-12-13T08:56:01.33245Z","LastModified":"2024-12-13T13:19:29.3497448Z","IsPublished":true,"MenuOnly":false,"ShowMenu":false,"ViewRoles":null,"Categories":[],"Comments":[],"ShowHeading":true,"ShowPubDate":false,"ShowLastModified":false,"ShowCategories":false,"ShowComments":false,"MenuFilters":null,"DisableEditor":false,"Resources":[{"Id":"4e561963-aa91-4c28-908e-4e22ab89a1b3","ContentId":null,"Sort":1,"Type":null,"Environment":null,"Url":null,"Script":null}],"ContentType":"html","CreatedUtc":"2024-12-13T08:56:01.3305956Z","CreatedByUser":"admin","LastModifiedByUser":"admin","DraftContent":null,"DraftAuthor":null,"DraftPubDate":null,"TemplateKey":null,"SerializedModel":null,"DraftSerializedModel":null,"Serializer":null,"ShowCreatedBy":null,"ShowCreatedDate":null,"ShowLastModifiedBy":null,"ShowLastModifiedDate":null,"Script":null} \ No newline at end of file diff --git a/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/siteuser/17595de8-d27a-4304-bded-76b61a16ad19.json b/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/siteuser/17595de8-d27a-4304-bded-76b61a16ad19.json index 39ab9c801..52b3c0087 100644 --- a/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/siteuser/17595de8-d27a-4304-bded-76b61a16ad19.json +++ b/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/siteuser/17595de8-d27a-4304-bded-76b61a16ad19.json @@ -1 +1 @@ -{"AuthorBio":"","Comment":"","NormalizedEmail":"ADMIN@ADMIN.COM","NormalizedUserName":"ADMIN","EmailConfirmed":true,"EmailConfirmSentUtc":null,"AgreementAcceptedUtc":null,"LockoutEndDateUtc":null,"NewEmail":"","NewEmailApproved":false,"LastPasswordChangeUtc":"2024-06-03T14:17:55.2771124Z","MustChangePwd":false,"PasswordHash":"AQAAAAIAAYagAAAAEGVnALS6pFN3EERYv0nYhCQ4jy0t3WB+uYVRUM40L55rqYdKv3yw1MmjWvEYd6x2Pw==","CanAutoLockout":true,"AccessFailedCount":0,"RolesChanged":false,"SecurityStamp":"S7ZJ6RCVYLDHBWTECX2S2GQXJKWUXNSL","Signature":"","TwoFactorEnabled":false,"BrowserKey":"73126636-c1ad-47c8-8f1d-9f229911e67a","Id":"17595de8-d27a-4304-bded-76b61a16ad19","SiteId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","Email":"admin@admin.com","UserName":"admin","DisplayName":"Admin","FirstName":"","LastName":"","AvatarUrl":"","DateOfBirth":null,"CreatedUtc":"2016-08-04T12:03:50.2175089Z","LastModifiedUtc":"2016-08-04T12:03:50.2175089Z","DisplayInMemberList":true,"Gender":"","IsLockedOut":false,"LastLoginUtc":"2024-12-13T08:41:39.832239Z","PhoneNumber":"","PhoneNumberConfirmed":false,"AccountApproved":true,"TimeZoneId":"","WebSiteUrl":""} \ No newline at end of file +{"AuthorBio":"","Comment":"","NormalizedEmail":"ADMIN@ADMIN.COM","NormalizedUserName":"ADMIN","EmailConfirmed":true,"EmailConfirmSentUtc":null,"AgreementAcceptedUtc":null,"LockoutEndDateUtc":null,"NewEmail":"","NewEmailApproved":false,"LastPasswordChangeUtc":"2024-06-03T14:17:55.2771124Z","MustChangePwd":false,"PasswordHash":"AQAAAAIAAYagAAAAEGVnALS6pFN3EERYv0nYhCQ4jy0t3WB+uYVRUM40L55rqYdKv3yw1MmjWvEYd6x2Pw==","CanAutoLockout":true,"AccessFailedCount":0,"RolesChanged":false,"SecurityStamp":"S7ZJ6RCVYLDHBWTECX2S2GQXJKWUXNSL","Signature":"","TwoFactorEnabled":false,"BrowserKey":"bacfa9cc-e6a1-49b0-8080-478d2eb75898","Id":"17595de8-d27a-4304-bded-76b61a16ad19","SiteId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","Email":"admin@admin.com","UserName":"admin","DisplayName":"Admin","FirstName":"","LastName":"","AvatarUrl":"","DateOfBirth":null,"CreatedUtc":"2016-08-04T12:03:50.2175089Z","LastModifiedUtc":"2016-08-04T12:03:50.2175089Z","DisplayInMemberList":true,"Gender":"","IsLockedOut":false,"LastLoginUtc":"2025-01-24T08:49:35.1254179Z","PhoneNumber":"","PhoneNumberConfirmed":false,"AccountApproved":true,"TimeZoneId":"","WebSiteUrl":""} \ No newline at end of file From f8bcbdac4f5edb8cf364c994056979b1be316e07 Mon Sep 17 00:00:00 2001 From: Mark Appleton Date: Fri, 24 Jan 2025 16:49:20 +0000 Subject: [PATCH 02/11] #482 allowing for script input into dev tools --- .../Views/Page/Index.cshtml | 10 +++++++++ .../ModelExtensions.cs | 1 + .../Page/IPage.cs | 1 + .../Page/Page.cs | 2 +- .../Controllers/PageController.cs | 22 +++++++++---------- .../ViewModels/PageDevelopmentViewModel.cs | 2 -- .../ViewModels/PageEditViewModel.cs | 1 + .../2c945759-1c3b-43ac-bf4b-241082ee6166.json | 2 +- .../869cf304-6409-4b4d-880a-a6aa00c37075.json | 2 +- 9 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml index 7536e1c5b..aa43609a2 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml @@ -50,12 +50,22 @@ { } + @foreach (var c in Model.CurrentPage.Resources.Where(x => x.Type == "js" && (x.Environment == "prod" || x.Environment == "any")).OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList()) { } + } diff --git a/src/cloudscribe.SimpleContent.Models/ModelExtensions.cs b/src/cloudscribe.SimpleContent.Models/ModelExtensions.cs index 0962ab933..7e7532691 100644 --- a/src/cloudscribe.SimpleContent.Models/ModelExtensions.cs +++ b/src/cloudscribe.SimpleContent.Models/ModelExtensions.cs @@ -310,6 +310,7 @@ public static void CopyTo(this IPage input, IPage target) target.ShowCreatedDate = input.ShowCreatedDate; target.ShowLastModifiedBy = input.ShowLastModifiedBy; target.ShowLastModifiedDate = input.ShowLastModifiedDate; + target.Script = input.Script; } /// diff --git a/src/cloudscribe.SimpleContent.Models/Page/IPage.cs b/src/cloudscribe.SimpleContent.Models/Page/IPage.cs index 78ce9c2c8..72a7f8a74 100644 --- a/src/cloudscribe.SimpleContent.Models/Page/IPage.cs +++ b/src/cloudscribe.SimpleContent.Models/Page/IPage.cs @@ -68,5 +68,6 @@ public interface IPage : IContentItem public bool? ShowCreatedDate { get; set; } public bool? ShowLastModifiedBy { get; set; } public bool? ShowLastModifiedDate { get; set; } + public string? Script { get; set; } } } \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.Models/Page/Page.cs b/src/cloudscribe.SimpleContent.Models/Page/Page.cs index d05cbb6ec..7e252eee1 100644 --- a/src/cloudscribe.SimpleContent.Models/Page/Page.cs +++ b/src/cloudscribe.SimpleContent.Models/Page/Page.cs @@ -101,6 +101,6 @@ public static Page FromIPage(IPage page) public bool? ShowCreatedDate { get; set; } public bool? ShowLastModifiedBy { get; set; } public bool? ShowLastModifiedDate { get; set; } - public string Script { get; set; } + public string? Script { get; set; } } } diff --git a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs index 6a6f8f51c..3ab43c380 100644 --- a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs +++ b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs @@ -902,7 +902,8 @@ public virtual async Task AddResource(AddPageResourceViewModel mo Type = model.Type, Environment = model.Environment, Sort = model.Sort, - Url = model.Url + Url = model.Url, + Script = model.Script }; editContext.CurrentPage.Resources.Add(resource); @@ -914,7 +915,7 @@ public virtual async Task AddResource(AddPageResourceViewModel mo [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] - public virtual async Task AddScriptResource(AddPageResourceViewModelScriptOnly model) + public virtual async Task AddScriptResource(PageEditViewModel model) { var editContextRequest = new PageEditContextRequest(User, model.Slug, null, model.Script, null); var editContext = await Mediator.Send(editContextRequest); @@ -932,10 +933,7 @@ public virtual async Task AddScriptResource(AddPageResourceViewMo return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = model.Slug }); } - if (!ModelState.IsValid) - { } - - if (!canDev) + if (!canDev) { Log.LogInformation("redirecting to index because user is not allowed by edit config for developer tools"); return RedirectToRoute(PageRoutes.PageRouteName); @@ -947,7 +945,7 @@ public virtual async Task AddScriptResource(AddPageResourceViewMo return RedirectToRoute(PageRoutes.PageRouteName, new { slug = "" }); } - if ((!string.IsNullOrEmpty(editContext.CurrentPage.ViewRoles))) + if (!string.IsNullOrEmpty(editContext.CurrentPage.ViewRoles)) { if (!User.IsInRoles(editContext.CurrentPage.ViewRoles)) { @@ -956,11 +954,11 @@ public virtual async Task AddScriptResource(AddPageResourceViewMo } } - //var resource = new PageResource - //{ - // Script = model.Script - //}; - //editContext.CurrentPage.Resources.Add(resource); + if (!model.Script.EndsWith(';')) + { + this.AlertDanger(StringLocalizer["Scripts should end with a semicolon"], true); + return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = editContext.CurrentPage.Slug }); + } editContext.CurrentPage.Script = model.Script; diff --git a/src/cloudscribe.SimpleContent.Web/ViewModels/PageDevelopmentViewModel.cs b/src/cloudscribe.SimpleContent.Web/ViewModels/PageDevelopmentViewModel.cs index 57e10ea84..6589125a1 100644 --- a/src/cloudscribe.SimpleContent.Web/ViewModels/PageDevelopmentViewModel.cs +++ b/src/cloudscribe.SimpleContent.Web/ViewModels/PageDevelopmentViewModel.cs @@ -18,7 +18,5 @@ public PageDevelopmentViewModel() public List Js { get; set; } public AddPageResourceViewModel AddResourceViewModel { get; set; } - - } } diff --git a/src/cloudscribe.SimpleContent.Web/ViewModels/PageEditViewModel.cs b/src/cloudscribe.SimpleContent.Web/ViewModels/PageEditViewModel.cs index d957a06e8..87621036b 100644 --- a/src/cloudscribe.SimpleContent.Web/ViewModels/PageEditViewModel.cs +++ b/src/cloudscribe.SimpleContent.Web/ViewModels/PageEditViewModel.cs @@ -80,5 +80,6 @@ public PageEditViewModel() public bool? ShowCreatedDate { get; set; } public bool? ShowLastModifiedBy { get; set; } public bool? ShowLastModifiedDate { get; set; } + public string? Script { get; set; } } } diff --git a/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/2c945759-1c3b-43ac-bf4b-241082ee6166.json b/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/2c945759-1c3b-43ac-bf4b-241082ee6166.json index c76ed8ca0..290a65ff2 100644 --- a/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/2c945759-1c3b-43ac-bf4b-241082ee6166.json +++ b/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/2c945759-1c3b-43ac-bf4b-241082ee6166.json @@ -1 +1 @@ -{"Id":"2c945759-1c3b-43ac-bf4b-241082ee6166","ProjectId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","ParentId":"0","ParentSlug":"","PageOrder":3,"Title":"About","Author":"","Slug":"about","ExternalUrl":null,"CorrelationKey":null,"MetaDescription":"meta meta meta","MetaJson":null,"MetaHtml":null,"Content":"

This could be an about page couldn't it so be true

\r\n\r\n

\"snow

\r\n\r\n

can we edit here then can we go to the beach or something

\r\n\r\n

what about pix and stuff

\r\n","PubDate":"2016-02-24T18:00:00Z","LastModified":"2018-02-05T21:36:50.1081798Z","IsPublished":true,"MenuOnly":false,"ShowMenu":false,"ViewRoles":null,"Categories":[],"Comments":[],"ShowHeading":true,"ShowPubDate":false,"ShowCategories":false,"ShowComments":false,"MenuFilters":null,"DisableEditor":false,"Resources":[],"ContentType":"html"} \ No newline at end of file +{"Id":"2c945759-1c3b-43ac-bf4b-241082ee6166","ProjectId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","ParentId":"0","ParentSlug":"","PageOrder":3,"Title":"About","Author":"","Slug":"about","ExternalUrl":null,"CorrelationKey":null,"MetaDescription":"meta meta meta","MetaJson":null,"MetaHtml":null,"Content":"

This could be an about page couldn't it so be true

\r\n\r\n

\"snow

\r\n\r\n

can we edit here then can we go to the beach or something

\r\n\r\n

what about pix and stuff

\r\n","PubDate":"2016-02-24T18:00:00Z","LastModified":"2025-01-24T14:30:46.8912066Z","IsPublished":true,"MenuOnly":false,"ShowMenu":false,"ViewRoles":null,"Categories":[],"Comments":[],"ShowHeading":true,"ShowPubDate":false,"ShowLastModified":false,"ShowCategories":false,"ShowComments":false,"MenuFilters":null,"DisableEditor":false,"Resources":[],"ContentType":"html","CreatedUtc":"2025-01-24T10:28:53.2710158Z","CreatedByUser":null,"LastModifiedByUser":null,"DraftContent":null,"DraftAuthor":null,"DraftPubDate":null,"TemplateKey":null,"SerializedModel":null,"DraftSerializedModel":null,"Serializer":null,"ShowCreatedBy":null,"ShowCreatedDate":null,"ShowLastModifiedBy":null,"ShowLastModifiedDate":null,"Script":"alert(\"hi\");\r\nalert(\"there\");"} \ No newline at end of file diff --git a/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/869cf304-6409-4b4d-880a-a6aa00c37075.json b/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/869cf304-6409-4b4d-880a-a6aa00c37075.json index c244210da..ed0446243 100644 --- a/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/869cf304-6409-4b4d-880a-a6aa00c37075.json +++ b/src/sourceDev.WebApp/nodb_storage/projects/f83067b4-919d-4910-acd1-4b3b1c210ecf/page/869cf304-6409-4b4d-880a-a6aa00c37075.json @@ -1 +1 @@ -{"Id":"869cf304-6409-4b4d-880a-a6aa00c37075","ProjectId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","ParentId":"0","ParentSlug":"","PageOrder":3,"Title":"Home","Author":"Admin","Slug":"home","ExternalUrl":null,"CorrelationKey":null,"MetaDescription":null,"MetaJson":null,"MetaHtml":null,"Content":"

Welcome Home!

\r\n\r\n

This is the home page!

\r\n","PubDate":"2017-03-10T18:40:00Z","LastModified":"2024-12-06T10:52:44.2801681Z","IsPublished":true,"MenuOnly":false,"ShowMenu":false,"ViewRoles":null,"Categories":[],"Comments":[],"ShowHeading":true,"ShowPubDate":false,"ShowLastModified":false,"ShowCategories":false,"ShowComments":false,"MenuFilters":null,"DisableEditor":false,"Resources":[],"ContentType":"html","CreatedUtc":"2022-01-25T13:46:15.8644194Z","CreatedByUser":null,"LastModifiedByUser":"admin","DraftContent":null,"DraftAuthor":null,"DraftPubDate":null,"TemplateKey":null,"SerializedModel":null,"DraftSerializedModel":null,"Serializer":null,"ShowCreatedBy":null,"ShowCreatedDate":null,"ShowLastModifiedBy":null,"ShowLastModifiedDate":null} \ No newline at end of file +{"Id":"869cf304-6409-4b4d-880a-a6aa00c37075","ProjectId":"f83067b4-919d-4910-acd1-4b3b1c210ecf","ParentId":"0","ParentSlug":"","PageOrder":3,"Title":"Home","Author":"Admin","Slug":"home","ExternalUrl":null,"CorrelationKey":null,"MetaDescription":null,"MetaJson":null,"MetaHtml":null,"Content":"

Welcome Home!

\r\n\r\n

This is the home page!

\r\n","PubDate":"2017-03-10T18:40:00Z","LastModified":"2025-01-24T10:25:42.5017972Z","IsPublished":true,"MenuOnly":false,"ShowMenu":false,"ViewRoles":null,"Categories":[],"Comments":[],"ShowHeading":true,"ShowPubDate":false,"ShowLastModified":false,"ShowCategories":false,"ShowComments":false,"MenuFilters":null,"DisableEditor":false,"Resources":[{"Id":"2adbc417-b75c-4a6f-a2f0-4f14e53958da","ContentId":null,"Sort":1,"Type":null,"Environment":null,"Url":null,"Script":"alert(\"hello\");"},{"Id":"735a6240-aceb-4e58-a8d2-e3844126e468","ContentId":"869cf304-6409-4b4d-880a-a6aa00c37075","Sort":1,"Type":null,"Environment":null,"Url":null,"Script":"test"}],"ContentType":"html","CreatedUtc":"2022-01-25T13:46:15.8644194Z","CreatedByUser":null,"LastModifiedByUser":"admin","DraftContent":null,"DraftAuthor":null,"DraftPubDate":null,"TemplateKey":null,"SerializedModel":null,"DraftSerializedModel":null,"Serializer":null,"ShowCreatedBy":null,"ShowCreatedDate":null,"ShowLastModifiedBy":null,"ShowLastModifiedDate":null,"Script":null} \ No newline at end of file From 3c5120f8c4e4489fd1f4fbbc2fc7314f5804d028 Mon Sep 17 00:00:00 2001 From: Mark Appleton Date: Wed, 23 Apr 2025 13:36:06 +0100 Subject: [PATCH 03/11] #482 allowing users to enter CSP-safe JS snippets onto a page. --- .../Views/Page/Development.cshtml | 2 +- .../Views/Page/Index.cshtml | 14 +- .../Views/Page/PageScriptsPartial.cshtml | 1 + ...423093650_user-script-20250423.Designer.cs | 1015 ++++++++++++++ .../20250423093650_user-script-20250423.cs | 48 + .../SimpleContentDbContextModelSnapshot.cs | 9 + ...423093954_user-script-20250423.Designer.cs | 967 +++++++++++++ .../20250423093954_user-script-20250423.cs | 51 + .../SimpleContentDbContextModelSnapshot.cs | 9 + ...423094338_user-script-20250423.Designer.cs | 1219 +++++++++++++++++ .../20250423094338_user-script-20250423.cs | 48 + .../SimpleContentDbContextModelSnapshot.cs | 12 + ...423094108_user-script-20250423.Designer.cs | 962 +++++++++++++ .../20250423094108_user-script-20250423.cs | 49 + .../SimpleContentDbContextModelSnapshot.cs | 554 ++++---- .../TagHelpers/SafeScriptTagHelper.cs | 25 + .../js/user-script-runner.js | 19 + 17 files changed, 4749 insertions(+), 255 deletions(-) create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250423093650_user-script-20250423.Designer.cs create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250423093650_user-script-20250423.cs create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250423093954_user-script-20250423.Designer.cs create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250423093954_user-script-20250423.cs create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250423094338_user-script-20250423.Designer.cs create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250423094338_user-script-20250423.cs create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/20250423094108_user-script-20250423.Designer.cs create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/20250423094108_user-script-20250423.cs create mode 100644 src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs create mode 100644 src/cloudscribe.SimpleContent.Web/js/user-script-runner.js diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml index a536b7bb3..b07673302 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml @@ -69,7 +69,7 @@
- +
diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml index aa43609a2..2f0dcdae1 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml @@ -50,22 +50,14 @@ { } - + @foreach (var c in Model.CurrentPage.Resources.Where(x => x.Type == "js" && (x.Environment == "prod" || x.Environment == "any")).OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList()) { } - + } @@ -77,12 +69,14 @@ { } + @foreach (var c in Model.Template.RenderScripts.Where(x => (x.Environment == "prod" || x.Environment == "any")).OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList()) { } + } } diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/PageScriptsPartial.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/PageScriptsPartial.cshtml index a348ffae0..a084da287 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/PageScriptsPartial.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/PageScriptsPartial.cshtml @@ -1,3 +1,4 @@ @model cloudscribe.SimpleContent.Web.ViewModels.PageViewModel + \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250423093650_user-script-20250423.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250423093650_user-script-20250423.Designer.cs new file mode 100644 index 000000000..2376b7a88 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250423093650_user-script-20250423.Designer.cs @@ -0,0 +1,1015 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using cloudscribe.SimpleContent.Storage.EFCore.MSSQL; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.MSSQL.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250423093650_user-script-20250423")] + partial class userscript20250423 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("uniqueidentifier"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ArchivedUtc") + .HasColumnType("datetime2"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CategoriesCsv") + .HasColumnType("nvarchar(max)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime2"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DraftContent") + .HasColumnType("nvarchar(max)"); + + b.Property("DraftPubDate") + .HasColumnType("datetime2"); + + b.Property("DraftSerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDraftHx") + .HasColumnType("bit"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MetaDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("MetaHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("MetaJson") + .HasColumnType("nvarchar(max)"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("SerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShowCreatedBy") + .HasColumnType("bit"); + + b.Property("ShowCreatedDate") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("bit"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("TeaserOverride") + .HasColumnType("nvarchar(max)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ViewRoles") + .HasColumnType("nvarchar(max)"); + + b.Property("WasDeleted") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.HasIndex("ContentSource"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("CreatedByUser"); + + b.HasIndex("LastModifiedByUser"); + + b.HasIndex("Title"); + + b.ToTable("cs_ContentHistory", null, t => + { + t.HasTrigger("cs_ContentHistory_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AboutContent") + .HasColumnType("nvarchar(max)"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("bit"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("bit"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("BlogPagePosition") + .HasColumnType("int"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ChannelTimeToLive") + .HasColumnType("int"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DaysToComment") + .HasColumnType("int"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasDefaultValue("html"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(20); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("bit"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1000); + + b.Property("ModerateComments") + .HasColumnType("bit"); + + b.Property("PostsPerPage") + .HasColumnType("int"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("nvarchar(75)"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ShowAboutBox") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ShowArchivedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ShowBlogCategories") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ShowCreatedBy") + .HasColumnType("bit"); + + b.Property("ShowCreatedDate") + .HasColumnType("bit"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("bit"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("bit"); + + b.Property("ShowRelatedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ShowTitle") + .HasColumnType("bit"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)0); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(20); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)0); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("bit"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("cs_ContentProject", null, t => + { + t.HasTrigger("cs_ContentProject_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Value", "PageEntityId"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PageCategory", null, t => + { + t.HasTrigger("cs_PageCategory_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsAdmin") + .HasColumnType("bit"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PageComment", null, t => + { + t.HasTrigger("cs_PageComment_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime2"); + + b.Property("DisableEditor") + .HasColumnType("bit"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DraftContent") + .HasColumnType("nvarchar(max)"); + + b.Property("DraftPubDate") + .HasColumnType("datetime2"); + + b.Property("DraftSerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("MenuOnly") + .HasColumnType("bit"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("MetaHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("MetaJson") + .HasColumnType("nvarchar(max)"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("Script") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShowCategories") + .HasColumnType("bit"); + + b.Property("ShowComments") + .HasColumnType("bit"); + + b.Property("ShowCreatedBy") + .HasColumnType("bit"); + + b.Property("ShowCreatedDate") + .HasColumnType("bit"); + + b.Property("ShowHeading") + .HasColumnType("bit"); + + b.Property("ShowLastModified") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("bit"); + + b.Property("ShowMenu") + .HasColumnType("bit"); + + b.Property("ShowPubDate") + .HasColumnType("bit"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ViewRoles") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_Page", null, t => + { + t.HasTrigger("cs_Page_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Script") + .HasColumnType("nvarchar(max)"); + + b.Property("Sort") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.ToTable("cs_PageResource", null, t => + { + t.HasTrigger("cs_PageResource_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Value", "PostEntityId"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PostCategory", null, t => + { + t.HasTrigger("cs_PostCategory_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsAdmin") + .HasColumnType("bit"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PostComment", null, t => + { + t.HasTrigger("cs_PostComment_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("AutoTeaser") + .HasColumnType("nvarchar(max)"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime2"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DraftContent") + .HasColumnType("nvarchar(max)"); + + b.Property("DraftPubDate") + .HasColumnType("datetime2"); + + b.Property("DraftSerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("MetaHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("MetaJson") + .HasColumnType("nvarchar(max)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("Script") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShowComments") + .HasColumnType("bit"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("SuppressTeaser") + .HasColumnType("bit"); + + b.Property("TeaserOverride") + .HasColumnType("nvarchar(max)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("Slug"); + + b.ToTable("cs_Post", null, t => + { + t.HasTrigger("cs_Post_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250423093650_user-script-20250423.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250423093650_user-script-20250423.cs new file mode 100644 index 000000000..30e4de2ce --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250423093650_user-script-20250423.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.MSSQL.Migrations +{ + /// + public partial class userscript20250423 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Script", + table: "cs_Post", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Script", + table: "cs_PageResource", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Script", + table: "cs_Page", + type: "nvarchar(max)", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Script", + table: "cs_Post"); + + migrationBuilder.DropColumn( + name: "Script", + table: "cs_PageResource"); + + migrationBuilder.DropColumn( + name: "Script", + table: "cs_Page"); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/SimpleContentDbContextModelSnapshot.cs index 4aaecf54f..a798fbd28 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -626,6 +626,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PubDate") .HasColumnType("datetime2"); + b.Property("Script") + .HasColumnType("nvarchar(max)"); + b.Property("SerializedModel") .HasColumnType("nvarchar(max)"); @@ -711,6 +714,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("nvarchar(36)"); + b.Property("Script") + .HasColumnType("nvarchar(max)"); + b.Property("Sort") .HasColumnType("int"); @@ -913,6 +919,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PubDate") .HasColumnType("datetime2"); + b.Property("Script") + .HasColumnType("nvarchar(max)"); + b.Property("SerializedModel") .HasColumnType("nvarchar(max)"); diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250423093954_user-script-20250423.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250423093954_user-script-20250423.Designer.cs new file mode 100644 index 000000000..6247223e1 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250423093954_user-script-20250423.Designer.cs @@ -0,0 +1,967 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using cloudscribe.SimpleContent.Storage.EFCore.MySQL; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.MySQL.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250423093954_user-script-20250423")] + partial class userscript20250423 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("char(36)"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ArchivedUtc") + .HasColumnType("datetime(6)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CategoriesCsv") + .HasColumnType("longtext"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime(6)"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DraftContent") + .HasColumnType("longtext"); + + b.Property("DraftPubDate") + .HasColumnType("datetime(6)"); + + b.Property("DraftSerializedModel") + .HasColumnType("longtext"); + + b.Property("IsDraftHx") + .HasColumnType("tinyint(1)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("LastModified") + .HasColumnType("datetime(6)"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("MetaDescription") + .HasColumnType("longtext"); + + b.Property("MetaHtml") + .HasColumnType("longtext"); + + b.Property("MetaJson") + .HasColumnType("longtext"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("SerializedModel") + .HasColumnType("longtext"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ShowCreatedBy") + .HasColumnType("tinyint(1)"); + + b.Property("ShowCreatedDate") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("tinyint(1)"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("TeaserOverride") + .HasColumnType("longtext"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ViewRoles") + .HasColumnType("longtext"); + + b.Property("WasDeleted") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.HasIndex("ContentSource"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("CreatedByUser"); + + b.HasIndex("LastModifiedByUser"); + + b.HasIndex("Title"); + + b.ToTable("cs_ContentHistory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("AboutContent") + .HasColumnType("longtext"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("tinyint(1)"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("tinyint(1)"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("BlogPagePosition") + .HasColumnType("int"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("ChannelTimeToLive") + .HasColumnType("int"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DaysToComment") + .HasColumnType("int"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValue("html"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(20); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("tinyint(1)"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1000); + + b.Property("ModerateComments") + .HasColumnType("tinyint(1)"); + + b.Property("PostsPerPage") + .HasColumnType("int"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("varchar(75)"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("varchar(20)"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("varchar(20)"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ShowAboutBox") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ShowArchivedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ShowBlogCategories") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ShowCreatedBy") + .HasColumnType("tinyint(1)"); + + b.Property("ShowCreatedDate") + .HasColumnType("tinyint(1)"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("tinyint(1)"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("tinyint(1)"); + + b.Property("ShowRelatedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ShowTitle") + .HasColumnType("tinyint(1)"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint unsigned") + .HasDefaultValue((byte)0); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(20); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint unsigned") + .HasDefaultValue((byte)0); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("tinyint(1)"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.HasKey("Id"); + + b.ToTable("cs_ContentProject", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Value", "PageEntityId"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PageCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PageComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime(6)"); + + b.Property("DisableEditor") + .HasColumnType("tinyint(1)"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DraftContent") + .HasColumnType("longtext"); + + b.Property("DraftPubDate") + .HasColumnType("datetime(6)"); + + b.Property("DraftSerializedModel") + .HasColumnType("longtext"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("LastModified") + .HasColumnType("datetime(6)"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("MenuOnly") + .HasColumnType("tinyint(1)"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("MetaHtml") + .HasColumnType("longtext"); + + b.Property("MetaJson") + .HasColumnType("longtext"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("Script") + .HasColumnType("longtext"); + + b.Property("SerializedModel") + .HasColumnType("longtext"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ShowCategories") + .HasColumnType("tinyint(1)"); + + b.Property("ShowComments") + .HasColumnType("tinyint(1)"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + + b.Property("ShowHeading") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModified") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + + b.Property("ShowMenu") + .HasColumnType("tinyint(1)"); + + b.Property("ShowPubDate") + .HasColumnType("tinyint(1)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ViewRoles") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_Page", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("varchar(15)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Script") + .HasColumnType("longtext"); + + b.Property("Sort") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.ToTable("cs_PageResource", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Value", "PostEntityId"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PostCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PostComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("AutoTeaser") + .HasColumnType("longtext"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime(6)"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DraftContent") + .HasColumnType("longtext"); + + b.Property("DraftPubDate") + .HasColumnType("datetime(6)"); + + b.Property("DraftSerializedModel") + .HasColumnType("longtext"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("IsFeatured") + .HasColumnType("tinyint(1)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("LastModified") + .HasColumnType("datetime(6)"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("MetaHtml") + .HasColumnType("longtext"); + + b.Property("MetaJson") + .HasColumnType("longtext"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("Script") + .HasColumnType("longtext"); + + b.Property("SerializedModel") + .HasColumnType("longtext"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ShowComments") + .HasColumnType("bit"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("SuppressTeaser") + .HasColumnType("tinyint(1)"); + + b.Property("TeaserOverride") + .HasColumnType("longtext"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("Slug"); + + b.ToTable("cs_Post", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250423093954_user-script-20250423.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250423093954_user-script-20250423.cs new file mode 100644 index 000000000..096eb522f --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250423093954_user-script-20250423.cs @@ -0,0 +1,51 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.MySQL.Migrations +{ + /// + public partial class userscript20250423 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Script", + table: "cs_Post", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "Script", + table: "cs_PageResource", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "Script", + table: "cs_Page", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Script", + table: "cs_Post"); + + migrationBuilder.DropColumn( + name: "Script", + table: "cs_PageResource"); + + migrationBuilder.DropColumn( + name: "Script", + table: "cs_Page"); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/SimpleContentDbContextModelSnapshot.cs index fabdc840a..ba51720cf 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -603,6 +603,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PubDate") .HasColumnType("datetime(6)"); + b.Property("Script") + .HasColumnType("longtext"); + b.Property("SerializedModel") .HasColumnType("longtext"); @@ -683,6 +686,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("varchar(36)"); + b.Property("Script") + .HasColumnType("longtext"); + b.Property("Sort") .HasColumnType("int"); @@ -870,6 +876,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PubDate") .HasColumnType("datetime(6)"); + b.Property("Script") + .HasColumnType("longtext"); + b.Property("SerializedModel") .HasColumnType("longtext"); diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250423094338_user-script-20250423.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250423094338_user-script-20250423.Designer.cs new file mode 100644 index 000000000..a32c2c771 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250423094338_user-script-20250423.Designer.cs @@ -0,0 +1,1219 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using cloudscribe.SimpleContent.Storage.EFCore.PostgreSql; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.PostgreSql.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250423094338_user-script-20250423")] + partial class userscript20250423 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("archived_by"); + + b.Property("ArchivedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("archived_utc"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("CategoriesCsv") + .HasColumnType("text") + .HasColumnName("categories_csv"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("content_id"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("content_source"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html") + .HasColumnName("content_type"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("correlation_key"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("created_by_user"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_utc"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("draft_author"); + + b.Property("DraftContent") + .HasColumnType("text") + .HasColumnName("draft_content"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("draft_pub_date"); + + b.Property("DraftSerializedModel") + .HasColumnType("text") + .HasColumnName("draft_serialized_model"); + + b.Property("IsDraftHx") + .HasColumnType("boolean") + .HasColumnName("is_draft_hx"); + + b.Property("IsPublished") + .HasColumnType("boolean") + .HasColumnName("is_published"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_modified"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("last_modified_by_user"); + + b.Property("MetaDescription") + .HasColumnType("text") + .HasColumnName("meta_description"); + + b.Property("MetaHtml") + .HasColumnType("text") + .HasColumnName("meta_html"); + + b.Property("MetaJson") + .HasColumnType("text") + .HasColumnName("meta_json"); + + b.Property("PageOrder") + .HasColumnType("integer") + .HasColumnName("page_order"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("parent_id"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("parent_slug"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("SerializedModel") + .HasColumnType("text") + .HasColumnName("serialized_model"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("serializer"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean") + .HasColumnName("show_created_by"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean") + .HasColumnName("show_created_date"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_by"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_date"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("slug"); + + b.Property("TeaserOverride") + .HasColumnType("text") + .HasColumnName("teaser_override"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("template_key"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("title"); + + b.Property("ViewRoles") + .HasColumnType("text") + .HasColumnName("view_roles"); + + b.Property("WasDeleted") + .HasColumnType("boolean") + .HasColumnName("was_deleted"); + + b.HasKey("Id") + .HasName("pk_cs_content_history"); + + b.HasIndex("ContentId") + .HasDatabaseName("ix_cs_content_history_content_id"); + + b.HasIndex("ContentSource") + .HasDatabaseName("ix_cs_content_history_content_source"); + + b.HasIndex("CorrelationKey") + .HasDatabaseName("ix_cs_content_history_correlation_key"); + + b.HasIndex("CreatedByUser") + .HasDatabaseName("ix_cs_content_history_created_by_user"); + + b.HasIndex("LastModifiedByUser") + .HasDatabaseName("ix_cs_content_history_last_modified_by_user"); + + b.HasIndex("Title") + .HasDatabaseName("ix_cs_content_history_title"); + + b.ToTable("cs_content_history", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("AboutContent") + .HasColumnType("text") + .HasColumnName("about_content"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("about_heading"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("boolean") + .HasColumnName("add_blog_to_pages_tree"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("boolean") + .HasColumnName("blog_menu_links_to_newest_post"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("blog_page_nav_component_visibility"); + + b.Property("BlogPagePosition") + .HasColumnType("integer") + .HasColumnName("blog_page_position"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("blog_page_text"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("cdn_url"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("channel_categories_csv"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("channel_rating"); + + b.Property("ChannelTimeToLive") + .HasColumnType("integer") + .HasColumnName("channel_time_to_live"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("comment_notification_email"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("copyright_notice"); + + b.Property("DaysToComment") + .HasColumnType("integer") + .HasColumnName("days_to_comment"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html") + .HasColumnName("default_content_type"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(20) + .HasColumnName("default_feed_items"); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("default_page_slug"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("disqus_short_name"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("facebook_app_id"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("image"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("boolean") + .HasColumnName("include_pub_date_in_post_urls"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("character varying(10)") + .HasColumnName("language_code"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("local_media_virtual_path"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("managing_editor_email"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1000) + .HasColumnName("max_feed_items"); + + b.Property("ModerateComments") + .HasColumnType("boolean") + .HasColumnName("moderate_comments"); + + b.Property("PostsPerPage") + .HasColumnType("integer") + .HasColumnName("posts_per_page"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("character varying(75)") + .HasColumnName("pub_date_format"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("publisher"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("publisher_entity_type"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasColumnName("publisher_logo_height"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("publisher_logo_url"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasColumnName("publisher_logo_width"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("recaptcha_private_key"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("recaptcha_public_key"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("remote_feed_processor_use_agent_fragment"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("remote_feed_url"); + + b.Property("ShowAboutBox") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("show_about_box"); + + b.Property("ShowArchivedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("show_archived_posts"); + + b.Property("ShowBlogCategories") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("show_blog_categories"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean") + .HasColumnName("show_created_by"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean") + .HasColumnName("show_created_date"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("boolean") + .HasColumnName("show_featured_posts_on_default_page"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_by"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_date"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("boolean") + .HasColumnName("show_recent_posts_on_default_page"); + + b.Property("ShowRelatedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("show_related_posts"); + + b.Property("ShowTitle") + .HasColumnType("boolean") + .HasColumnName("show_title"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("site_name"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)0) + .HasColumnName("teaser_mode"); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(20) + .HasColumnName("teaser_truncation_length"); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)0) + .HasColumnName("teaser_truncation_mode"); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("time_zone_id"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("title"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("twitter_creator"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("twitter_publisher"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("boolean") + .HasColumnName("use_default_page_as_root_node"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("webmaster_email"); + + b.HasKey("Id") + .HasName("pk_cs_content_project"); + + b.ToTable("cs_content_project", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("value"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("page_entity_id"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.HasKey("Value", "PageEntityId") + .HasName("pk_cs_page_category"); + + b.HasIndex("PageEntityId") + .HasDatabaseName("ix_cs_page_category_page_entity_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_page_category_project_id"); + + b.HasIndex("Value") + .HasDatabaseName("ix_cs_page_category_value"); + + b.ToTable("cs_page_category", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("email"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("ip"); + + b.Property("IsAdmin") + .HasColumnType("boolean") + .HasColumnName("is_admin"); + + b.Property("IsApproved") + .HasColumnType("boolean") + .HasColumnName("is_approved"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("page_entity_id"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("user_agent"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_cs_page_comment"); + + b.HasIndex("PageEntityId") + .HasDatabaseName("ix_cs_page_comment_page_entity_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_page_comment_project_id"); + + b.ToTable("cs_page_comment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("categories_csv"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html") + .HasColumnName("content_type"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("correlation_key"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("created_by_user"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_utc"); + + b.Property("DisableEditor") + .HasColumnType("boolean") + .HasColumnName("disable_editor"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("draft_author"); + + b.Property("DraftContent") + .HasColumnType("text") + .HasColumnName("draft_content"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("draft_pub_date"); + + b.Property("DraftSerializedModel") + .HasColumnType("text") + .HasColumnName("draft_serialized_model"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("external_url"); + + b.Property("IsPublished") + .HasColumnType("boolean") + .HasColumnName("is_published"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_modified"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("last_modified_by_user"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("menu_filters"); + + b.Property("MenuOnly") + .HasColumnType("boolean") + .HasColumnName("menu_only"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("meta_description"); + + b.Property("MetaHtml") + .HasColumnType("text") + .HasColumnName("meta_html"); + + b.Property("MetaJson") + .HasColumnType("text") + .HasColumnName("meta_json"); + + b.Property("PageOrder") + .HasColumnType("integer") + .HasColumnName("page_order"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("parent_id"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("parent_slug"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("Script") + .HasColumnType("text") + .HasColumnName("script"); + + b.Property("SerializedModel") + .HasColumnType("text") + .HasColumnName("serialized_model"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("serializer"); + + b.Property("ShowCategories") + .HasColumnType("boolean") + .HasColumnName("show_categories"); + + b.Property("ShowComments") + .HasColumnType("boolean") + .HasColumnName("show_comments"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean") + .HasColumnName("show_created_by"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean") + .HasColumnName("show_created_date"); + + b.Property("ShowHeading") + .HasColumnType("boolean") + .HasColumnName("show_heading"); + + b.Property("ShowLastModified") + .HasColumnType("boolean") + .HasColumnName("show_last_modified"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_by"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_date"); + + b.Property("ShowMenu") + .HasColumnType("boolean") + .HasColumnName("show_menu"); + + b.Property("ShowPubDate") + .HasColumnType("boolean") + .HasColumnName("show_pub_date"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("slug"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("template_key"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("title"); + + b.Property("ViewRoles") + .HasColumnType("text") + .HasColumnName("view_roles"); + + b.HasKey("Id") + .HasName("pk_cs_page"); + + b.HasIndex("CorrelationKey") + .HasDatabaseName("ix_cs_page_correlation_key"); + + b.HasIndex("ParentId") + .HasDatabaseName("ix_cs_page_parent_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_page_project_id"); + + b.ToTable("cs_page", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("character varying(15)") + .HasColumnName("environment"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("page_entity_id"); + + b.Property("Script") + .HasColumnType("text") + .HasColumnName("script"); + + b.Property("Sort") + .HasColumnType("integer") + .HasColumnName("sort"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("character varying(10)") + .HasColumnName("type"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("url"); + + b.HasKey("Id") + .HasName("pk_cs_page_resource"); + + b.HasIndex("PageEntityId") + .HasDatabaseName("ix_cs_page_resource_page_entity_id"); + + b.ToTable("cs_page_resource", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("value"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("post_entity_id"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.HasKey("Value", "PostEntityId") + .HasName("pk_cs_post_category"); + + b.HasIndex("PostEntityId") + .HasDatabaseName("ix_cs_post_category_post_entity_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_post_category_project_id"); + + b.HasIndex("Value") + .HasDatabaseName("ix_cs_post_category_value"); + + b.ToTable("cs_post_category", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("email"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("ip"); + + b.Property("IsAdmin") + .HasColumnType("boolean") + .HasColumnName("is_admin"); + + b.Property("IsApproved") + .HasColumnType("boolean") + .HasColumnName("is_approved"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("post_entity_id"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("user_agent"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_cs_post_comment"); + + b.HasIndex("PostEntityId") + .HasDatabaseName("ix_cs_post_comment_post_entity_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_post_comment_project_id"); + + b.ToTable("cs_post_comment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("AutoTeaser") + .HasColumnType("text") + .HasColumnName("auto_teaser"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("blog_id"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("categories_csv"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html") + .HasColumnName("content_type"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("correlation_key"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("created_by_user"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_utc"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("draft_author"); + + b.Property("DraftContent") + .HasColumnType("text") + .HasColumnName("draft_content"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("draft_pub_date"); + + b.Property("DraftSerializedModel") + .HasColumnType("text") + .HasColumnName("draft_serialized_model"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("character varying(250)") + .HasColumnName("image_url"); + + b.Property("IsFeatured") + .HasColumnType("boolean") + .HasColumnName("is_featured"); + + b.Property("IsPublished") + .HasColumnType("boolean") + .HasColumnName("is_published"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_modified"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("last_modified_by_user"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("meta_description"); + + b.Property("MetaHtml") + .HasColumnType("text") + .HasColumnName("meta_html"); + + b.Property("MetaJson") + .HasColumnType("text") + .HasColumnName("meta_json"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("Script") + .HasColumnType("text") + .HasColumnName("script"); + + b.Property("SerializedModel") + .HasColumnType("text") + .HasColumnName("serialized_model"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("serializer"); + + b.Property("ShowComments") + .HasColumnType("boolean") + .HasColumnName("show_comments"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("slug"); + + b.Property("SuppressTeaser") + .HasColumnType("boolean") + .HasColumnName("suppress_teaser"); + + b.Property("TeaserOverride") + .HasColumnType("text") + .HasColumnName("teaser_override"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("template_key"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("character varying(250)") + .HasColumnName("thumbnail_url"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("title"); + + b.HasKey("Id") + .HasName("pk_cs_post"); + + b.HasIndex("BlogId") + .HasDatabaseName("ix_cs_post_blog_id"); + + b.HasIndex("CorrelationKey") + .HasDatabaseName("ix_cs_post_correlation_key"); + + b.HasIndex("Slug") + .HasDatabaseName("ix_cs_post_slug"); + + b.ToTable("cs_post", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_cs_page_comment_cs_page_page_entity_id"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_cs_page_resource_cs_page_page_entity_id"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId") + .HasConstraintName("fk_cs_post_comment_cs_post_post_entity_id"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250423094338_user-script-20250423.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250423094338_user-script-20250423.cs new file mode 100644 index 000000000..51e026b2b --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250423094338_user-script-20250423.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.PostgreSql.Migrations +{ + /// + public partial class userscript20250423 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "script", + table: "cs_post", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "script", + table: "cs_page_resource", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "script", + table: "cs_page", + type: "text", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "script", + table: "cs_post"); + + migrationBuilder.DropColumn( + name: "script", + table: "cs_page_resource"); + + migrationBuilder.DropColumn( + name: "script", + table: "cs_page"); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/SimpleContentDbContextModelSnapshot.cs index 0ccae7d25..c9fdb2b74 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -763,6 +763,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("timestamp with time zone") .HasColumnName("pub_date"); + b.Property("Script") + .HasColumnType("text") + .HasColumnName("script"); + b.Property("SerializedModel") .HasColumnType("text") .HasColumnName("serialized_model"); @@ -866,6 +870,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(36)") .HasColumnName("page_entity_id"); + b.Property("Script") + .HasColumnType("text") + .HasColumnName("script"); + b.Property("Sort") .HasColumnType("integer") .HasColumnName("sort"); @@ -1103,6 +1111,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("timestamp with time zone") .HasColumnName("pub_date"); + b.Property("Script") + .HasColumnType("text") + .HasColumnName("script"); + b.Property("SerializedModel") .HasColumnType("text") .HasColumnName("serialized_model"); diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/20250423094108_user-script-20250423.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/20250423094108_user-script-20250423.Designer.cs new file mode 100644 index 000000000..790be8203 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/20250423094108_user-script-20250423.Designer.cs @@ -0,0 +1,962 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using cloudscribe.SimpleContent.Storage.EFCore.pgsql; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.pgsql.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250423094108_user-script-20250423")] + partial class userscript20250423 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("uuid"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ArchivedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CategoriesCsv") + .HasColumnType("text"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("DraftContent") + .HasColumnType("text"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DraftSerializedModel") + .HasColumnType("text"); + + b.Property("IsDraftHx") + .HasColumnType("boolean"); + + b.Property("IsPublished") + .HasColumnType("boolean"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("MetaDescription") + .HasColumnType("text"); + + b.Property("MetaHtml") + .HasColumnType("text"); + + b.Property("MetaJson") + .HasColumnType("text"); + + b.Property("PageOrder") + .HasColumnType("integer"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone"); + + b.Property("SerializedModel") + .HasColumnType("text"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("TeaserOverride") + .HasColumnType("text"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ViewRoles") + .HasColumnType("text"); + + b.Property("WasDeleted") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.HasIndex("ContentSource"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("CreatedByUser"); + + b.HasIndex("LastModifiedByUser"); + + b.HasIndex("Title"); + + b.ToTable("cs_ContentHistory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("AboutContent") + .HasColumnType("text"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("boolean"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("boolean"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("BlogPagePosition") + .HasColumnType("integer"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ChannelTimeToLive") + .HasColumnType("integer"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("DaysToComment") + .HasColumnType("integer"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(20); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("boolean"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("character varying(10)"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1000); + + b.Property("ModerateComments") + .HasColumnType("boolean"); + + b.Property("PostsPerPage") + .HasColumnType("integer"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("character varying(75)"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ShowAboutBox") + .HasColumnType("boolean"); + + b.Property("ShowArchivedPosts") + .HasColumnType("boolean"); + + b.Property("ShowBlogCategories") + .HasColumnType("boolean"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("boolean"); + + b.Property("ShowRelatedPosts") + .HasColumnType("boolean"); + + b.Property("ShowTitle") + .HasColumnType("boolean"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)0); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(20); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)0); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("boolean"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.ToTable("cs_ContentProject", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Value", "PageEntityId"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PageCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("IsAdmin") + .HasColumnType("boolean"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PageComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("DisableEditor") + .HasColumnType("boolean"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("DraftContent") + .HasColumnType("text"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DraftSerializedModel") + .HasColumnType("text"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("IsPublished") + .HasColumnType("boolean"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("MenuOnly") + .HasColumnType("boolean"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("MetaHtml") + .HasColumnType("text"); + + b.Property("MetaJson") + .HasColumnType("text"); + + b.Property("PageOrder") + .HasColumnType("integer"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Script") + .HasColumnType("text"); + + b.Property("SerializedModel") + .HasColumnType("text"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ShowCategories") + .HasColumnType("boolean"); + + b.Property("ShowComments") + .HasColumnType("boolean"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + + b.Property("ShowHeading") + .HasColumnType("boolean"); + + b.Property("ShowLastModified") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + + b.Property("ShowMenu") + .HasColumnType("boolean"); + + b.Property("ShowPubDate") + .HasColumnType("boolean"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ViewRoles") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_Page", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("character varying(15)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("Script") + .HasColumnType("text"); + + b.Property("Sort") + .HasColumnType("integer"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("character varying(10)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.ToTable("cs_PageResource", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Value", "PostEntityId"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PostCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("IsAdmin") + .HasColumnType("boolean"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PostComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("AutoTeaser") + .HasColumnType("text"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("DraftContent") + .HasColumnType("text"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DraftSerializedModel") + .HasColumnType("text"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("IsFeatured") + .HasColumnType("boolean"); + + b.Property("IsPublished") + .HasColumnType("boolean"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("MetaHtml") + .HasColumnType("text"); + + b.Property("MetaJson") + .HasColumnType("text"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Script") + .HasColumnType("text"); + + b.Property("SerializedModel") + .HasColumnType("text"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ShowComments") + .HasColumnType("boolean"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("SuppressTeaser") + .HasColumnType("boolean"); + + b.Property("TeaserOverride") + .HasColumnType("text"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("Slug"); + + b.ToTable("cs_Post", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/20250423094108_user-script-20250423.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/20250423094108_user-script-20250423.cs new file mode 100644 index 000000000..2c34fc164 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/20250423094108_user-script-20250423.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.pgsql.Migrations +{ + /// + public partial class userscript20250423 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Script", + table: "cs_Post", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "Script", + table: "cs_PageResource", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "Script", + table: "cs_Page", + type: "text", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Script", + table: "cs_Post"); + + migrationBuilder.DropColumn( + name: "Script", + table: "cs_PageResource"); + + migrationBuilder.DropColumn( + name: "Script", + table: "cs_Page"); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/SimpleContentDbContextModelSnapshot.cs index 8a70b766a..f44dd65a0 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.pgsql/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -6,6 +6,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using cloudscribe.SimpleContent.Storage.EFCore.pgsql; +#nullable disable + namespace cloudscribe.SimpleContent.Storage.EFCore.pgsql.Migrations { [DbContext(typeof(SimpleContentDbContext))] @@ -15,27 +17,28 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("uuid"); b.Property("ArchivedBy") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ArchivedUtc") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("Author") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("CategoriesCsv") .HasColumnType("text"); @@ -45,40 +48,40 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ContentId") .IsRequired() - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("ContentSource") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("ContentType") .ValueGeneratedOnAdd() - .HasColumnType("character varying(50)") .HasMaxLength(50) + .HasColumnType("character varying(50)") .HasDefaultValue("html"); b.Property("CorrelationKey") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("CreatedByUser") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("CreatedUtc") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DraftAuthor") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("DraftContent") .HasColumnType("text"); b.Property("DraftPubDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DraftSerializedModel") .HasColumnType("text"); @@ -90,11 +93,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedByUser") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("MetaDescription") .HasColumnType("text"); @@ -109,42 +112,54 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("integer"); b.Property("ParentId") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ParentSlug") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ProjectId") - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("PubDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("SerializedModel") .HasColumnType("text"); b.Property("Serializer") - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); b.Property("Slug") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("TeaserOverride") .HasColumnType("text"); b.Property("TemplateKey") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("Title") .IsRequired() - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ViewRoles") .HasColumnType("text"); @@ -166,21 +181,21 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Title"); - b.ToTable("cs_ContentHistory"); + b.ToTable("cs_ContentHistory", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => { b.Property("Id") - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("AboutContent") .HasColumnType("text"); b.Property("AboutHeading") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("AddBlogToPagesTree") .HasColumnType("boolean"); @@ -189,46 +204,46 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("BlogPageNavComponentVisibility") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("BlogPagePosition") .HasColumnType("integer"); b.Property("BlogPageText") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("CdnUrl") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ChannelCategoriesCsv") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ChannelRating") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("ChannelTimeToLive") .HasColumnType("integer"); b.Property("CommentNotificationEmail") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("CopyrightNotice") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("DaysToComment") .HasColumnType("integer"); b.Property("DefaultContentType") .ValueGeneratedOnAdd() - .HasColumnType("character varying(50)") .HasMaxLength(50) + .HasColumnType("character varying(50)") .HasDefaultValue("html"); b.Property("DefaultFeedItems") @@ -237,38 +252,38 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDefaultValue(20); b.Property("DefaultPageSlug") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("Description") .HasColumnType("text"); b.Property("DisqusShortName") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("FacebookAppId") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("Image") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("IncludePubDateInPostUrls") .HasColumnType("boolean"); b.Property("LanguageCode") - .HasColumnType("character varying(10)") - .HasMaxLength(10); + .HasMaxLength(10) + .HasColumnType("character varying(10)"); b.Property("LocalMediaVirtualPath") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ManagingEditorEmail") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("MaxFeedItems") .ValueGeneratedOnAdd() @@ -282,51 +297,69 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("integer"); b.Property("PubDateFormat") - .HasColumnType("character varying(75)") - .HasMaxLength(75); + .HasMaxLength(75) + .HasColumnType("character varying(75)"); b.Property("Publisher") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("PublisherEntityType") - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("PublisherLogoHeight") - .HasColumnType("character varying(20)") - .HasMaxLength(20); + .HasMaxLength(20) + .HasColumnType("character varying(20)"); b.Property("PublisherLogoUrl") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("PublisherLogoWidth") - .HasColumnType("character varying(20)") - .HasMaxLength(20); + .HasMaxLength(20) + .HasColumnType("character varying(20)"); b.Property("RecaptchaPrivateKey") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("RecaptchaPublicKey") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("RemoteFeedProcessorUseAgentFragment") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("RemoteFeedUrl") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ShowAboutBox") .HasColumnType("boolean"); + b.Property("ShowArchivedPosts") + .HasColumnType("boolean"); + + b.Property("ShowBlogCategories") + .HasColumnType("boolean"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + b.Property("ShowFeaturedPostsOnDefaultPage") .HasColumnType("boolean"); + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + b.Property("ShowRecentPostsOnDefaultPage") .HasColumnType("boolean"); @@ -337,8 +370,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("SiteName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("TeaserMode") .ValueGeneratedOnAdd() @@ -356,47 +389,47 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDefaultValue((byte)0); b.Property("TimeZoneId") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("Title") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("TwitterCreator") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("TwitterPublisher") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("UseDefaultPageAsRootNode") .HasColumnType("boolean"); b.Property("WebmasterEmail") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.HasKey("Id"); - b.ToTable("cs_ContentProject"); + b.ToTable("cs_ContentProject", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => { b.Property("Value") - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("PageEntityId") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("ProjectId") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.HasKey("Value", "PageEntityId"); @@ -406,29 +439,29 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Value"); - b.ToTable("cs_PageCategory"); + b.ToTable("cs_PageCategory", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => { b.Property("Id") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("Author") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("Content") .HasColumnType("text"); b.Property("Email") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("Ip") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("IsAdmin") .HasColumnType("boolean"); @@ -437,24 +470,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("PageEntityId") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("ProjectId") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("PubDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("UserAgent") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("Website") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.HasKey("Id"); @@ -462,83 +495,83 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ProjectId"); - b.ToTable("cs_PageComment"); + b.ToTable("cs_PageComment", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => { b.Property("Id") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("Author") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("CategoriesCsv") - .HasColumnType("character varying(500)") - .HasMaxLength(500); + .HasMaxLength(500) + .HasColumnType("character varying(500)"); b.Property("Content") .HasColumnType("text"); b.Property("ContentType") .ValueGeneratedOnAdd() - .HasColumnType("character varying(50)") .HasMaxLength(50) + .HasColumnType("character varying(50)") .HasDefaultValue("html"); b.Property("CorrelationKey") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("CreatedByUser") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("CreatedUtc") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DisableEditor") .HasColumnType("boolean"); b.Property("DraftAuthor") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("DraftContent") .HasColumnType("text"); b.Property("DraftPubDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DraftSerializedModel") .HasColumnType("text"); b.Property("ExternalUrl") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("IsPublished") .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedByUser") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("MenuFilters") - .HasColumnType("character varying(500)") - .HasMaxLength(500); + .HasMaxLength(500) + .HasColumnType("character varying(500)"); b.Property("MenuOnly") .HasColumnType("boolean"); b.Property("MetaDescription") - .HasColumnType("character varying(500)") - .HasMaxLength(500); + .HasMaxLength(500) + .HasColumnType("character varying(500)"); b.Property("MetaHtml") .HasColumnType("text"); @@ -550,27 +583,30 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("integer"); b.Property("ParentId") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("ParentSlug") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ProjectId") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("PubDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); + + b.Property("Script") + .HasColumnType("text"); b.Property("SerializedModel") .HasColumnType("text"); b.Property("Serializer") - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("ShowCategories") .HasColumnType("boolean"); @@ -578,12 +614,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ShowComments") .HasColumnType("boolean"); + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + b.Property("ShowHeading") .HasColumnType("boolean"); b.Property("ShowLastModified") .HasColumnType("boolean"); + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + b.Property("ShowMenu") .HasColumnType("boolean"); @@ -592,17 +640,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Slug") .IsRequired() - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("TemplateKey") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("Title") .IsRequired() - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ViewRoles") .HasColumnType("text"); @@ -615,58 +663,61 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ProjectId"); - b.ToTable("cs_Page"); + b.ToTable("cs_Page", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => { b.Property("Id") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("Environment") .IsRequired() - .HasColumnType("character varying(15)") - .HasMaxLength(15); + .HasMaxLength(15) + .HasColumnType("character varying(15)"); b.Property("PageEntityId") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); + + b.Property("Script") + .HasColumnType("text"); b.Property("Sort") .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("character varying(10)") - .HasMaxLength(10); + .HasMaxLength(10) + .HasColumnType("character varying(10)"); b.Property("Url") .IsRequired() - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.HasKey("Id"); b.HasIndex("PageEntityId"); - b.ToTable("cs_PageResource"); + b.ToTable("cs_PageResource", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => { b.Property("Value") - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("PostEntityId") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("ProjectId") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.HasKey("Value", "PostEntityId"); @@ -676,29 +727,29 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Value"); - b.ToTable("cs_PostCategory"); + b.ToTable("cs_PostCategory", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => { b.Property("Id") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("Author") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("Content") .HasColumnType("text"); b.Property("Email") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("Ip") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("IsAdmin") .HasColumnType("boolean"); @@ -707,24 +758,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("PostEntityId") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("ProjectId") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("PubDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("UserAgent") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("Website") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.HasKey("Id"); @@ -732,67 +783,67 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ProjectId"); - b.ToTable("cs_PostComment"); + b.ToTable("cs_PostComment", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => { b.Property("Id") - .HasColumnType("character varying(36)") - .HasMaxLength(36); + .HasMaxLength(36) + .HasColumnType("character varying(36)"); b.Property("Author") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("AutoTeaser") .HasColumnType("text"); b.Property("BlogId") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("CategoriesCsv") - .HasColumnType("character varying(500)") - .HasMaxLength(500); + .HasMaxLength(500) + .HasColumnType("character varying(500)"); b.Property("Content") .HasColumnType("text"); b.Property("ContentType") .ValueGeneratedOnAdd() - .HasColumnType("character varying(50)") .HasMaxLength(50) + .HasColumnType("character varying(50)") .HasDefaultValue("html"); b.Property("CorrelationKey") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("CreatedByUser") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("CreatedUtc") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DraftAuthor") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("DraftContent") .HasColumnType("text"); b.Property("DraftPubDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("DraftSerializedModel") .HasColumnType("text"); b.Property("ImageUrl") - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("IsFeatured") .HasColumnType("boolean"); @@ -801,15 +852,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedByUser") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("MetaDescription") - .HasColumnType("character varying(500)") - .HasMaxLength(500); + .HasMaxLength(500) + .HasColumnType("character varying(500)"); b.Property("MetaHtml") .HasColumnType("text"); @@ -818,22 +869,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("PubDate") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); + + b.Property("Script") + .HasColumnType("text"); b.Property("SerializedModel") .HasColumnType("text"); b.Property("Serializer") - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.Property("ShowComments") .HasColumnType("boolean"); b.Property("Slug") .IsRequired() - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("SuppressTeaser") .HasColumnType("boolean"); @@ -842,17 +896,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("TemplateKey") - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ThumbnailUrl") - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Title") .IsRequired() - .HasColumnType("character varying(255)") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.HasKey("Id"); @@ -862,7 +916,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Slug"); - b.ToTable("cs_Post"); + b.ToTable("cs_Post", (string)null); }); modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => @@ -887,6 +941,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) .WithMany("PostComments") .HasForeignKey("PostEntityId"); }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); #pragma warning restore 612, 618 } } diff --git a/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs b/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs new file mode 100644 index 000000000..e32eb269c --- /dev/null +++ b/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.Razor.TagHelpers; +using System.Text.Encodings.Web; + +namespace cloudscribe.SimpleContent.Web.TagHelpers +{ + [HtmlTargetElement("safe-script")] + public class SafeScriptTagHelper : TagHelper + { + public string Script { get; set; } + + public override void Process(TagHelperContext context, TagHelperOutput output) + { + output.TagName = "div"; + output.Attributes.SetAttribute("id", "user-script-container"); + + if (!string.IsNullOrWhiteSpace(Script)) + { + string encodedScript = JavaScriptEncoder.Default.Encode(Script); + output.Attributes.SetAttribute("data-user-script", encodedScript); + } + + output.TagMode = TagMode.StartTagAndEndTag; + } + } +} \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js b/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js new file mode 100644 index 000000000..1aec86b29 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js @@ -0,0 +1,19 @@ +document.addEventListener("DOMContentLoaded", function () { + const container = document.getElementById("user-script-container"); + if (!container) return; + + let scriptContent = container.getAttribute("data-user-script"); + if (!scriptContent) return; + + try { + scriptContent = JSON.parse(`"${scriptContent}"`); + + const scriptEl = document.createElement("script"); + scriptEl.type = "text/javascript"; + scriptEl.textContent = scriptContent; + + document.body.appendChild(scriptEl); + } catch (error) { + console.error("Error executing user script:", error); + } +}); \ No newline at end of file From 17ace074fc0519e58419154b4fb12fd6f5ec3cd0 Mon Sep 17 00:00:00 2001 From: Jim Kerslake <39943820+JimKerslake@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:03:08 +0100 Subject: [PATCH 04/11] #482 solution that plays nicely with CSP and sanitises JS - jk --- .../Views/Page/Index.cshtml | 4 - .../Views/Page/PageScriptsPartial.cshtml | 6 +- .../Controllers/PageController.cs | 27 +++- .../Services/Page/JsSecuritySanitizer.cs | 132 ++++++++++++++++++ .../StartupExtensions.cs | 1 + .../TagHelpers/SafeScriptTagHelper.cs | 1 + .../cloudscribe.SimpleContent.Web.csproj | 2 + .../js/user-script-runner.js | 6 +- 8 files changed, 171 insertions(+), 8 deletions(-) create mode 100644 src/cloudscribe.SimpleContent.Web/Services/Page/JsSecuritySanitizer.cs diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml index 2f0dcdae1..7536e1c5b 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Index.cshtml @@ -50,14 +50,12 @@ { } - @foreach (var c in Model.CurrentPage.Resources.Where(x => x.Type == "js" && (x.Environment == "prod" || x.Environment == "any")).OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList()) { } - } @@ -69,14 +67,12 @@ { } - @foreach (var c in Model.Template.RenderScripts.Where(x => (x.Environment == "prod" || x.Environment == "any")).OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList()) { } - } } diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/PageScriptsPartial.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/PageScriptsPartial.cshtml index a084da287..4b9737f15 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/PageScriptsPartial.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/PageScriptsPartial.cshtml @@ -1,4 +1,8 @@ @model cloudscribe.SimpleContent.Web.ViewModels.PageViewModel - \ No newline at end of file + +@if (Model.CurrentPage?.Script != null && !string.IsNullOrWhiteSpace(Model.CurrentPage.Script)) +{ + +} \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs index 2a4342d91..889e3e68d 100644 --- a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs +++ b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs @@ -8,6 +8,7 @@ using cloudscribe.DateTimeUtils; using cloudscribe.SimpleContent.Models; using cloudscribe.SimpleContent.Models.Versioning; +using cloudscribe.SimpleContent.Services; using cloudscribe.SimpleContent.Web.Services; using cloudscribe.SimpleContent.Web.ViewModels; using cloudscribe.Web.Common.Extensions; @@ -47,7 +48,9 @@ public PageController( IStringLocalizer localizer, ITreeCache treeCache, DraftPublishService draftPublishService, + JsSecuritySanitizer jsSecuritySanitizer, IOptions pageEditOptionsAccessor, + ILogger logger) { Mediator = mediator; @@ -66,6 +69,7 @@ public PageController( StringLocalizer = localizer; NavigationCache = treeCache; DraftPublishService = draftPublishService; + JsSecuritySanitizer = jsSecuritySanitizer; Log = logger; } @@ -86,7 +90,7 @@ public PageController( protected ITreeCache NavigationCache { get; private set; } protected DraftPublishService DraftPublishService { get; private set; } - + public JsSecuritySanitizer JsSecuritySanitizer { get; private set; } protected IMediator Mediator { get; private set; } [HttpHead] @@ -1490,5 +1494,26 @@ public virtual async Task CanEdit(CancellationToken cancellationT } return showItems; } + + public async Task InlineScript(string pageId) + { + IPage page = await PageService.GetPage(pageId); + + if (page != null && !string.IsNullOrWhiteSpace(page.Script)) + { + var sanitizer = new JsSecuritySanitizer(); + + if (!sanitizer.IsSafe(page.Script, out var issues)) + { + Log.LogWarning("Unsafe user-defined script blocked on page " + (page.Slug ?? pageId) + " : " + string.Join(", ", issues)); + return Content("// Unsafe user-defined script blocked!", "application/javascript"); + } + + Response.Headers["Content-Security-Policy"] = "default-src 'none'; script-src 'self';"; + return Content(page.Script, "application/javascript"); + } + + return NoContent(); // HTTP 204 + } } } diff --git a/src/cloudscribe.SimpleContent.Web/Services/Page/JsSecuritySanitizer.cs b/src/cloudscribe.SimpleContent.Web/Services/Page/JsSecuritySanitizer.cs new file mode 100644 index 000000000..174e61198 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Web/Services/Page/JsSecuritySanitizer.cs @@ -0,0 +1,132 @@ + +//This product includes software developed by Sebastien Ros and contributors (https://github.com/sebastienros/esprima-dotnet). + +//Esprima.NET is licensed under the BSD 2-Clause License: + +//Copyright(c) 2014, Sebastien Ros +//All rights reserved. + +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions are met: + +//1.Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. + +//2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. + +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + + +using Esprima; +using Esprima.Ast; +using System.Collections.Generic; + +namespace cloudscribe.SimpleContent.Web.Services +{ + public class JsSecuritySanitizer + { + private static readonly HashSet DangerousCalls = new() + { + "eval", // Executes arbitrary strings as code + "Function", // Creates functions from strings (like eval) + "setTimeout", // Often used with string eval + "setInterval", // Same + "execScript", // IE-specific eval alternative + // "alert", // Common in test payloads (may remove if just for dev) + "confirm", // Can be used to trick users + "prompt", // Same + "fetch", // Sends data out + "XMLHttpRequest", // Same + "open", // Opens new windows/tabs + "showModalDialog", // Obsolete, but sometimes used for phishing + "postMessage", // Can be abused for cross-origin data leaks + "webkitRequestFullscreen", // Abused for phishing + "requestFullscreen", // Tricking users + "requestPointerLock", // Locking pointer as part of scams + }; + + private static readonly HashSet DangerousProperties = new() + { + "document.cookie", // Accesses user's cookies + "window.location", // Can redirect user or steal location + "location.href", // Commonly set to redirect + "document.location", // Same + "window.name", // Used to pass data between domains + "localStorage", // Persistent local storage + "sessionStorage", // Session-scoped storage + "indexedDB", // DB access + "navigator.geolocation", // Gets user location + "navigator.clipboard", // Read/write clipboard + "navigator.sendBeacon", // Sends data after page unload + "navigator.mediaDevices", // Webcam/mic access + "window.parent", // Cross-frame manipulation + "window.top", // Can break out of iframes + "window.opener", // Can hijack the opener page + "window.history", // Modify browser history + }; + + public bool IsSafe(string script, out List issues) + { + issues = new List(); + + try + { + var parser = new JavaScriptParser(); + var program = parser.ParseScript(script); + + TraverseNode(program, issues); + return issues.Count == 0; + } + catch (ParserException ex) + { + issues.Add($"Parsing error: {ex.Message}"); + return false; + } + } + + private void TraverseNode(Node node, List issues) + { + if (node == null) return; + + // Check for dangerous function calls + if (node is CallExpression callExpr) + { + if (callExpr.Callee is Identifier ident && + DangerousCalls.Contains(ident.Name)) + { + issues.Add($"Call to disallowed function: {ident.Name}"); + } + } + + // Check for dangerous property access like window.location or document.cookie + if (node is MemberExpression memberExpr && + memberExpr.Object is Identifier obj && + memberExpr.Property is Identifier prop) + { + string fullAccess = $"{obj.Name}.{prop.Name}"; + if (DangerousProperties.Contains(fullAccess)) + { + issues.Add($"Access to disallowed property: {fullAccess}"); + } + } + + // Recursively walk all child nodes + foreach (var child in node.ChildNodes) + { + TraverseNode(child, issues); + } + } + } +} diff --git a/src/cloudscribe.SimpleContent.Web/StartupExtensions.cs b/src/cloudscribe.SimpleContent.Web/StartupExtensions.cs index 7fefe3549..b8a8ad1c1 100644 --- a/src/cloudscribe.SimpleContent.Web/StartupExtensions.cs +++ b/src/cloudscribe.SimpleContent.Web/StartupExtensions.cs @@ -36,6 +36,7 @@ IConfiguration configuration services.TryAddScoped(); services.AddScoped(); + services.AddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); diff --git a/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs b/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs index e32eb269c..7ab1411d3 100644 --- a/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs +++ b/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs @@ -3,6 +3,7 @@ namespace cloudscribe.SimpleContent.Web.TagHelpers { + // Not currently in production use - jk [HtmlTargetElement("safe-script")] public class SafeScriptTagHelper : TagHelper { diff --git a/src/cloudscribe.SimpleContent.Web/cloudscribe.SimpleContent.Web.csproj b/src/cloudscribe.SimpleContent.Web/cloudscribe.SimpleContent.Web.csproj index 9429cff36..628d13909 100644 --- a/src/cloudscribe.SimpleContent.Web/cloudscribe.SimpleContent.Web.csproj +++ b/src/cloudscribe.SimpleContent.Web/cloudscribe.SimpleContent.Web.csproj @@ -57,6 +57,8 @@ + + diff --git a/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js b/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js index 1aec86b29..f6ab338a0 100644 --- a/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js +++ b/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js @@ -1,4 +1,6 @@ -document.addEventListener("DOMContentLoaded", function () { +// Not currently in production - jk + +document.addEventListener("DOMContentLoaded", function () { const container = document.getElementById("user-script-container"); if (!container) return; @@ -8,7 +10,7 @@ try { scriptContent = JSON.parse(`"${scriptContent}"`); - const scriptEl = document.createElement("script"); + const scriptEl = document.createElement("script"); // may violate CSP 'UnsafeInline' scriptEl.type = "text/javascript"; scriptEl.textContent = scriptContent; From f9d46bd249cd856bbec38de0c3fd4b40b7fbf192 Mon Sep 17 00:00:00 2001 From: Jim Kerslake <39943820+JimKerslake@users.noreply.github.com> Date: Fri, 15 Aug 2025 10:42:27 +0100 Subject: [PATCH 05/11] #482 missing migrations, clearing up messy ui issues --- ...92116_simplecontent-userscript.Designer.cs | 965 ++++++++++++++++++ ...20250815092116_simplecontent-userscript.cs | 48 + .../SimpleContentDbContextModelSnapshot.cs | 9 + .../Controllers/PageController.cs | 76 +- .../TagHelpers/SafeScriptTagHelper.cs | 26 - .../js/user-script-runner.js | 21 - 6 files changed, 1081 insertions(+), 64 deletions(-) create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250815092116_simplecontent-userscript.Designer.cs create mode 100644 src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250815092116_simplecontent-userscript.cs delete mode 100644 src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs delete mode 100644 src/cloudscribe.SimpleContent.Web/js/user-script-runner.js diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250815092116_simplecontent-userscript.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250815092116_simplecontent-userscript.Designer.cs new file mode 100644 index 000000000..154cfe7c5 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250815092116_simplecontent-userscript.Designer.cs @@ -0,0 +1,965 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using cloudscribe.SimpleContent.Storage.EFCore.SQLite; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.SQLite.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250815092116_simplecontent-userscript")] + partial class simplecontentuserscript + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.0"); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ArchivedUtc") + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CategoriesCsv") + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("TEXT"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("DraftContent") + .HasColumnType("TEXT"); + + b.Property("DraftPubDate") + .HasColumnType("TEXT"); + + b.Property("DraftSerializedModel") + .HasColumnType("TEXT"); + + b.Property("IsDraftHx") + .HasColumnType("INTEGER"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("LastModified") + .HasColumnType("TEXT"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("MetaDescription") + .HasColumnType("TEXT"); + + b.Property("MetaHtml") + .HasColumnType("TEXT"); + + b.Property("MetaJson") + .HasColumnType("TEXT"); + + b.Property("PageOrder") + .HasColumnType("INTEGER"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("SerializedModel") + .HasColumnType("TEXT"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ShowCreatedBy") + .HasColumnType("INTEGER"); + + b.Property("ShowCreatedDate") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("INTEGER"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("TeaserOverride") + .HasColumnType("TEXT"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ViewRoles") + .HasColumnType("TEXT"); + + b.Property("WasDeleted") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.HasIndex("ContentSource"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("CreatedByUser"); + + b.HasIndex("LastModifiedByUser"); + + b.HasIndex("Title"); + + b.ToTable("cs_ContentHistory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AboutContent") + .HasColumnType("TEXT"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("INTEGER"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("INTEGER"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("BlogPagePosition") + .HasColumnType("INTEGER"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChannelTimeToLive") + .HasColumnType("INTEGER"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("DaysToComment") + .HasColumnType("INTEGER"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasDefaultValue("html"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(20); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("INTEGER"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(1000); + + b.Property("ModerateComments") + .HasColumnType("INTEGER"); + + b.Property("PostsPerPage") + .HasColumnType("INTEGER"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("TEXT"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ShowAboutBox") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ShowArchivedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ShowBlogCategories") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ShowCreatedBy") + .HasColumnType("INTEGER"); + + b.Property("ShowCreatedDate") + .HasColumnType("INTEGER"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("INTEGER"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("INTEGER"); + + b.Property("ShowRelatedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ShowTitle") + .HasColumnType("INTEGER"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue((byte)0); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(20); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue((byte)0); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("INTEGER"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("cs_ContentProject", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Value", "PageEntityId"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PageCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsAdmin") + .HasColumnType("INTEGER"); + + b.Property("IsApproved") + .HasColumnType("INTEGER"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PageComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("TEXT"); + + b.Property("DisableEditor") + .HasColumnType("INTEGER"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("DraftContent") + .HasColumnType("TEXT"); + + b.Property("DraftPubDate") + .HasColumnType("TEXT"); + + b.Property("DraftSerializedModel") + .HasColumnType("TEXT"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("LastModified") + .HasColumnType("TEXT"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MenuOnly") + .HasColumnType("INTEGER"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MetaHtml") + .HasColumnType("TEXT"); + + b.Property("MetaJson") + .HasColumnType("TEXT"); + + b.Property("PageOrder") + .HasColumnType("INTEGER"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("Script") + .HasColumnType("TEXT"); + + b.Property("SerializedModel") + .HasColumnType("TEXT"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ShowCategories") + .HasColumnType("INTEGER"); + + b.Property("ShowComments") + .HasColumnType("INTEGER"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + + b.Property("ShowHeading") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModified") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + + b.Property("ShowMenu") + .HasColumnType("INTEGER"); + + b.Property("ShowPubDate") + .HasColumnType("INTEGER"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ViewRoles") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_Page", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("TEXT"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Script") + .HasColumnType("TEXT"); + + b.Property("Sort") + .HasColumnType("INTEGER"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.ToTable("cs_PageResource", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Value", "PostEntityId"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PostCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsAdmin") + .HasColumnType("INTEGER"); + + b.Property("IsApproved") + .HasColumnType("INTEGER"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PostComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("AutoTeaser") + .HasColumnType("TEXT"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("TEXT"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("DraftContent") + .HasColumnType("TEXT"); + + b.Property("DraftPubDate") + .HasColumnType("TEXT"); + + b.Property("DraftSerializedModel") + .HasColumnType("TEXT"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("IsFeatured") + .HasColumnType("INTEGER"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("LastModified") + .HasColumnType("TEXT"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MetaHtml") + .HasColumnType("TEXT"); + + b.Property("MetaJson") + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("Script") + .HasColumnType("TEXT"); + + b.Property("SerializedModel") + .HasColumnType("TEXT"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ShowComments") + .HasColumnType("INTEGER"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("SuppressTeaser") + .HasColumnType("INTEGER"); + + b.Property("TeaserOverride") + .HasColumnType("TEXT"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("Slug"); + + b.ToTable("cs_Post", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250815092116_simplecontent-userscript.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250815092116_simplecontent-userscript.cs new file mode 100644 index 000000000..cc8516891 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250815092116_simplecontent-userscript.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.SQLite.Migrations +{ + /// + public partial class simplecontentuserscript : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Script", + table: "cs_Post", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "Script", + table: "cs_PageResource", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "Script", + table: "cs_Page", + type: "TEXT", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Script", + table: "cs_Post"); + + migrationBuilder.DropColumn( + name: "Script", + table: "cs_PageResource"); + + migrationBuilder.DropColumn( + name: "Script", + table: "cs_Page"); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/SimpleContentDbContextModelSnapshot.cs index b6e449e71..987a09d1e 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -601,6 +601,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PubDate") .HasColumnType("TEXT"); + b.Property("Script") + .HasColumnType("TEXT"); + b.Property("SerializedModel") .HasColumnType("TEXT"); @@ -681,6 +684,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("TEXT"); + b.Property("Script") + .HasColumnType("TEXT"); + b.Property("Sort") .HasColumnType("INTEGER"); @@ -868,6 +874,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PubDate") .HasColumnType("TEXT"); + b.Property("Script") + .HasColumnType("TEXT"); + b.Property("SerializedModel") .HasColumnType("TEXT"); diff --git a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs index 889e3e68d..a564a5e05 100644 --- a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs +++ b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs @@ -931,12 +931,6 @@ public virtual async Task AddScriptResource(PageEditViewModel mod return RedirectToRoute(PageRoutes.PageRouteName, new { slug = "" }); } - if (string.IsNullOrEmpty(model.Script)) - { - this.AlertDanger(StringLocalizer["Invalid request"], true); - return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = model.Slug }); - } - if (!canDev) { Log.LogInformation("redirecting to index because user is not allowed by edit config for developer tools"); @@ -958,12 +952,32 @@ public virtual async Task AddScriptResource(PageEditViewModel mod } } + // Allow empty script to clear/remove existing script + if (string.IsNullOrEmpty(model.Script)) + { + editContext.CurrentPage.Script = null; // Clear the script + await PageService.Update(editContext.CurrentPage); + this.AlertSuccess(StringLocalizer["Script cleared successfully"], true); + return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = editContext.CurrentPage.Slug }); + } + if (!model.Script.EndsWith(';')) { this.AlertDanger(StringLocalizer["Scripts should end with a semicolon"], true); return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = editContext.CurrentPage.Slug }); } + // Validate script security before saving + var sanitizer = new JsSecuritySanitizer(); + if (!sanitizer.IsSafe(model.Script, out var issues)) + { + var errorMessage = $"Script blocked due to security violations: {string.Join(", ", issues)}"; // too helpful?! + // var errorMessage = $"Script blocked due to security violations - check the log for details"; + this.AlertDanger(StringLocalizer[errorMessage], true); + Log.LogWarning("Unsafe user-defined script blocked for page " + (editContext.CurrentPage.Slug ?? editContext.CurrentPage.Id) + " : " + string.Join(", ", issues)); + return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = editContext.CurrentPage.Slug }); + } + editContext.CurrentPage.Script = model.Script; await PageService.Update(editContext.CurrentPage); @@ -1495,25 +1509,53 @@ public virtual async Task CanEdit(CancellationToken cancellationT return showItems; } + [HttpGet] + [AllowAnonymous] public async Task InlineScript(string pageId) { - IPage page = await PageService.GetPage(pageId); + if (string.IsNullOrWhiteSpace(pageId)) + { + return NoContent(); + } - if (page != null && !string.IsNullOrWhiteSpace(page.Script)) + IPage page = await PageService.GetPage(pageId); + + if (page?.Script == null) { - var sanitizer = new JsSecuritySanitizer(); + return NoContent(); // HTTP 204 + } - if (!sanitizer.IsSafe(page.Script, out var issues)) - { - Log.LogWarning("Unsafe user-defined script blocked on page " + (page.Slug ?? pageId) + " : " + string.Join(", ", issues)); - return Content("// Unsafe user-defined script blocked!", "application/javascript"); - } + if (string.IsNullOrWhiteSpace(page.Script)) + { + return NoContent(); + } - Response.Headers["Content-Security-Policy"] = "default-src 'none'; script-src 'self';"; - return Content(page.Script, "application/javascript"); + var sanitizer = new JsSecuritySanitizer(); + + if (!sanitizer.IsSafe(page.Script, out var issues)) + { + Log.LogWarning("Unsafe user-defined script blocked on page " + (page.Slug ?? pageId) + " : " + string.Join(", ", issues)); + + // Return a more helpful error message for developers + var errorScript = $"console.warn('Script blocked due to security violations: {string.Join(", ", issues)}');"; + return Content(errorScript, "application/javascript"); + } + + // Add caching headers for performance + var etag = $"\"{page.Id}-{page.LastModified.Ticks}\""; + Response.Headers["ETag"] = etag; + Response.Headers["Cache-Control"] = "public, max-age=3600"; // Cache for 1 hour + + // Check if client has cached version + if (Request.Headers.IfNoneMatch == etag) + { + return StatusCode(304); // Not Modified } - return NoContent(); // HTTP 204 + // Improved CSP header - less restrictive but still secure + Response.Headers["Content-Security-Policy"] = "script-src 'self'; object-src 'none';"; + + return Content(page.Script, "application/javascript"); } } } diff --git a/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs b/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs deleted file mode 100644 index 7ab1411d3..000000000 --- a/src/cloudscribe.SimpleContent.Web/TagHelpers/SafeScriptTagHelper.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.AspNetCore.Razor.TagHelpers; -using System.Text.Encodings.Web; - -namespace cloudscribe.SimpleContent.Web.TagHelpers -{ - // Not currently in production use - jk - [HtmlTargetElement("safe-script")] - public class SafeScriptTagHelper : TagHelper - { - public string Script { get; set; } - - public override void Process(TagHelperContext context, TagHelperOutput output) - { - output.TagName = "div"; - output.Attributes.SetAttribute("id", "user-script-container"); - - if (!string.IsNullOrWhiteSpace(Script)) - { - string encodedScript = JavaScriptEncoder.Default.Encode(Script); - output.Attributes.SetAttribute("data-user-script", encodedScript); - } - - output.TagMode = TagMode.StartTagAndEndTag; - } - } -} \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js b/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js deleted file mode 100644 index f6ab338a0..000000000 --- a/src/cloudscribe.SimpleContent.Web/js/user-script-runner.js +++ /dev/null @@ -1,21 +0,0 @@ -// Not currently in production - jk - -document.addEventListener("DOMContentLoaded", function () { - const container = document.getElementById("user-script-container"); - if (!container) return; - - let scriptContent = container.getAttribute("data-user-script"); - if (!scriptContent) return; - - try { - scriptContent = JSON.parse(`"${scriptContent}"`); - - const scriptEl = document.createElement("script"); // may violate CSP 'UnsafeInline' - scriptEl.type = "text/javascript"; - scriptEl.textContent = scriptContent; - - document.body.appendChild(scriptEl); - } catch (error) { - console.error("Error executing user script:", error); - } -}); \ No newline at end of file From 525c77b85062ca0bbd11bd7a37a3d016f5bd8f30 Mon Sep 17 00:00:00 2001 From: Jim Kerslake <39943820+JimKerslake@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:19:47 +0100 Subject: [PATCH 06/11] #482 UI refinement --- .../Views/Page/AddJsPartial.cshtml | 2 +- .../Views/Page/Development.cshtml | 43 +++++++++++++------ .../Controllers/PageController.cs | 14 +++++- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/AddJsPartial.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/AddJsPartial.cshtml index 4ae9632a8..4fbf11b8d 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/AddJsPartial.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/AddJsPartial.cshtml @@ -22,5 +22,5 @@ - + diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml index b07673302..3d11b0c95 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/Development.cshtml @@ -1,9 +1,33 @@ @model cloudscribe.SimpleContent.Web.ViewModels.PageDevelopmentViewModel @inject IPageRoutes pageRoutes @inject IStringLocalizer sr -

@ViewBag.Title @sr["Cancel"]

-

@sr["With great power comes great responsibility. This page is intended for use by developers, for adding javscript and css into the page. Use this page only if you understand what you are doing."]

-
+
+

@ViewBag.Title

+ @sr["Return to Page Editing"] +
+
+ @sr["With great power comes great responsibility. This page is intended for use by developers, for adding javscript and css into the page. Use this page only if you understand what you are doing."] +
+ +

@sr["Raw JavaScript"]

+
+
+
+
diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditScriptsPartial.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditScriptsPartial.cshtml index b7ba6d741..7d9003f78 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditScriptsPartial.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditScriptsPartial.cshtml @@ -27,4 +27,5 @@ else } } + \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditWithTemplate.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditWithTemplate.cshtml index d197bf4c8..16dbe6fb8 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditWithTemplate.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditWithTemplate.cshtml @@ -156,7 +156,7 @@ } @if (showDev) { - @sr["Developer Tools"] + @sr["Developer Tools"] }
diff --git a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditWithTemplateScriptsPartial.cshtml b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditWithTemplateScriptsPartial.cshtml index 820168fe7..d69fd2064 100644 --- a/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditWithTemplateScriptsPartial.cshtml +++ b/src/cloudscribe.SimpleContent.CompiledViews.Bootstrap5/Views/Page/EditWithTemplateScriptsPartial.cshtml @@ -33,4 +33,5 @@ } + \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.Web/js/unsaved-changes-warning.js b/src/cloudscribe.SimpleContent.Web/js/unsaved-changes-warning.js new file mode 100644 index 000000000..1874532cf --- /dev/null +++ b/src/cloudscribe.SimpleContent.Web/js/unsaved-changes-warning.js @@ -0,0 +1,67 @@ +// Unsaved changes warning for Summernote editor +(function() { + 'use strict'; + + let summernoteChanged = false; + + // Wait for DOM to be ready + document.addEventListener('DOMContentLoaded', function() { + // Find all Summernote textareas + const summernoteTextareas = document.querySelectorAll('[data-summernote-unobtrusive]'); + if (summernoteTextareas.length === 0) { + return; // No Summernote on this page + } + + // Wait for Summernote to initialize (it's loaded asynchronously) + const checkSummernote = setInterval(function() { + if (typeof $ !== 'undefined' && $.fn.summernote) { + // Check if all Summernote instances are initialized + let allInitialized = true; + summernoteTextareas.forEach(function(textarea) { + if (!$(textarea).data('summernote')) { + allInitialized = false; + } + }); + + if (allInitialized) { + clearInterval(checkSummernote); + + // Listen for Summernote change events on all instances + summernoteTextareas.forEach(function(textarea) { + $(textarea).on('summernote.change', function() { + summernoteChanged = true; + }); + }); + + // Find Developer Tools link + const devToolsLink = document.querySelector('a[data-unsaved-warning]'); + if (devToolsLink) { + devToolsLink.addEventListener('click', function(e) { + if (summernoteChanged) { + const warningText = devToolsLink.getAttribute('data-unsaved-warning') || 'You have unsaved changes in the editor. Are you sure you want to navigate to Developer Tools? Your changes will be lost.'; + const confirmLeave = confirm(warningText); + if (!confirmLeave) { + e.preventDefault(); + return false; + } + } + }); + } + + // Reset the flag when form is submitted successfully + const form = document.querySelector('form[data-submit-once="true"]'); + if (form) { + form.addEventListener('submit', function() { + summernoteChanged = false; + }); + } + } + } + }, 100); + + // Stop checking after 10 seconds (failsafe) + setTimeout(function() { + clearInterval(checkSummernote); + }, 10000); + }); +})(); \ No newline at end of file From fef78addff690905739277017cfd7ea804c7aa7a Mon Sep 17 00:00:00 2001 From: Jim Kerslake <39943820+JimKerslake@users.noreply.github.com> Date: Fri, 15 Aug 2025 15:21:26 +0100 Subject: [PATCH 08/11] #482 resx work --- .../GlobalResources/SimpleContent.en-US.resx | 60 ++ .../GlobalResources/SimpleContent.resx | 648 ++++++++++++++++++ 2 files changed, 708 insertions(+) create mode 100644 src/sourceDev.WebApp/GlobalResources/SimpleContent.resx diff --git a/src/sourceDev.WebApp/GlobalResources/SimpleContent.en-US.resx b/src/sourceDev.WebApp/GlobalResources/SimpleContent.en-US.resx index ecdf16b1a..ac33f6c46 100644 --- a/src/sourceDev.WebApp/GlobalResources/SimpleContent.en-US.resx +++ b/src/sourceDev.WebApp/GlobalResources/SimpleContent.en-US.resx @@ -585,4 +585,64 @@ Show / hide the following information below the main content of pages (site default). + + You have unsaved changes in the editor. Are you sure you want to navigate to Developer Tools? Your changes will be lost. + + + Raw JavaScript + + + Enter your JavaScript below. Do not include + } \ No newline at end of file diff --git a/src/cloudscribe.SimpleContent.Models/Page/PageResource.cs b/src/cloudscribe.SimpleContent.Models/Page/PageResource.cs index 0c7569c81..f862b1af1 100644 --- a/src/cloudscribe.SimpleContent.Models/Page/PageResource.cs +++ b/src/cloudscribe.SimpleContent.Models/Page/PageResource.cs @@ -19,7 +19,6 @@ public interface IPageResource ///
string Environment { get; set; } string Url { get; set; } - string Script { get; set; } } public class PageResource : IPageResource @@ -35,7 +34,6 @@ public PageResource() public string Type { get; set; } public string Environment { get; set; } public string Url { get; set; } - public string Script { get; set; } public static PageResource FromIPageResource(IPageResource r) { @@ -46,7 +44,6 @@ public static PageResource FromIPageResource(IPageResource r) resource.Sort = r.Sort; resource.Type = r.Type; resource.Url = r.Url; - resource.Script = r.Script; return resource; diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageResourceEntity.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageResourceEntity.cs index 027d6cef7..bf7b4907e 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageResourceEntity.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.Common/Models/PageResourceEntity.cs @@ -28,7 +28,6 @@ public string PageEntityId public string Type { get; set; } public string Environment { get; set; } public string Url { get; set; } - public string Script { get; set; } public static PageResourceEntity FromIPageResource(IPageResource r) { @@ -39,7 +38,6 @@ public static PageResourceEntity FromIPageResource(IPageResource r) resource.Sort = r.Sort; resource.Type = r.Type; resource.Url = r.Url; - resource.Script = r.Script; return resource; diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250818152838_remove-pageresource-script.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250818152838_remove-pageresource-script.Designer.cs new file mode 100644 index 000000000..397b9d9bb --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250818152838_remove-pageresource-script.Designer.cs @@ -0,0 +1,1012 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using cloudscribe.SimpleContent.Storage.EFCore.MSSQL; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.MSSQL.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250818152838_remove-pageresource-script")] + partial class removepageresourcescript + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("uniqueidentifier"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ArchivedUtc") + .HasColumnType("datetime2"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CategoriesCsv") + .HasColumnType("nvarchar(max)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime2"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DraftContent") + .HasColumnType("nvarchar(max)"); + + b.Property("DraftPubDate") + .HasColumnType("datetime2"); + + b.Property("DraftSerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDraftHx") + .HasColumnType("bit"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MetaDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("MetaHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("MetaJson") + .HasColumnType("nvarchar(max)"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("SerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShowCreatedBy") + .HasColumnType("bit"); + + b.Property("ShowCreatedDate") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("bit"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("TeaserOverride") + .HasColumnType("nvarchar(max)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ViewRoles") + .HasColumnType("nvarchar(max)"); + + b.Property("WasDeleted") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.HasIndex("ContentSource"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("CreatedByUser"); + + b.HasIndex("LastModifiedByUser"); + + b.HasIndex("Title"); + + b.ToTable("cs_ContentHistory", null, t => + { + t.HasTrigger("cs_ContentHistory_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AboutContent") + .HasColumnType("nvarchar(max)"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("bit"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("bit"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("BlogPagePosition") + .HasColumnType("int"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ChannelTimeToLive") + .HasColumnType("int"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DaysToComment") + .HasColumnType("int"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasDefaultValue("html"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(20); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("bit"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1000); + + b.Property("ModerateComments") + .HasColumnType("bit"); + + b.Property("PostsPerPage") + .HasColumnType("int"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("nvarchar(75)"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ShowAboutBox") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ShowArchivedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ShowBlogCategories") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ShowCreatedBy") + .HasColumnType("bit"); + + b.Property("ShowCreatedDate") + .HasColumnType("bit"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("bit"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("bit"); + + b.Property("ShowRelatedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ShowTitle") + .HasColumnType("bit"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)0); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(20); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)0); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("bit"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("cs_ContentProject", null, t => + { + t.HasTrigger("cs_ContentProject_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Value", "PageEntityId"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PageCategory", null, t => + { + t.HasTrigger("cs_PageCategory_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsAdmin") + .HasColumnType("bit"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PageComment", null, t => + { + t.HasTrigger("cs_PageComment_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime2"); + + b.Property("DisableEditor") + .HasColumnType("bit"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DraftContent") + .HasColumnType("nvarchar(max)"); + + b.Property("DraftPubDate") + .HasColumnType("datetime2"); + + b.Property("DraftSerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("MenuOnly") + .HasColumnType("bit"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("MetaHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("MetaJson") + .HasColumnType("nvarchar(max)"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("Script") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShowCategories") + .HasColumnType("bit"); + + b.Property("ShowComments") + .HasColumnType("bit"); + + b.Property("ShowCreatedBy") + .HasColumnType("bit"); + + b.Property("ShowCreatedDate") + .HasColumnType("bit"); + + b.Property("ShowHeading") + .HasColumnType("bit"); + + b.Property("ShowLastModified") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("bit"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("bit"); + + b.Property("ShowMenu") + .HasColumnType("bit"); + + b.Property("ShowPubDate") + .HasColumnType("bit"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ViewRoles") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_Page", null, t => + { + t.HasTrigger("cs_Page_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Sort") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.ToTable("cs_PageResource", null, t => + { + t.HasTrigger("cs_PageResource_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Value", "PostEntityId"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PostCategory", null, t => + { + t.HasTrigger("cs_PostCategory_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsAdmin") + .HasColumnType("bit"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PostComment", null, t => + { + t.HasTrigger("cs_PostComment_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("AutoTeaser") + .HasColumnType("nvarchar(max)"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime2"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DraftContent") + .HasColumnType("nvarchar(max)"); + + b.Property("DraftPubDate") + .HasColumnType("datetime2"); + + b.Property("DraftSerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("MetaHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("MetaJson") + .HasColumnType("nvarchar(max)"); + + b.Property("PubDate") + .HasColumnType("datetime2"); + + b.Property("Script") + .HasColumnType("nvarchar(max)"); + + b.Property("SerializedModel") + .HasColumnType("nvarchar(max)"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShowComments") + .HasColumnType("bit"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("SuppressTeaser") + .HasColumnType("bit"); + + b.Property("TeaserOverride") + .HasColumnType("nvarchar(max)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("Slug"); + + b.ToTable("cs_Post", null, t => + { + t.HasTrigger("cs_Post_Trigger"); + }); + + b.HasAnnotation("SqlServer:UseSqlOutputClause", false); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250818152838_remove-pageresource-script.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250818152838_remove-pageresource-script.cs new file mode 100644 index 000000000..084117bae --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/20250818152838_remove-pageresource-script.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.MSSQL.Migrations +{ + /// + public partial class removepageresourcescript : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Script", + table: "cs_PageResource"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Script", + table: "cs_PageResource", + type: "nvarchar(max)", + nullable: true); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/SimpleContentDbContextModelSnapshot.cs index a798fbd28..d9449d8d2 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MSSQL/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -714,9 +714,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("nvarchar(36)"); - b.Property("Script") - .HasColumnType("nvarchar(max)"); - b.Property("Sort") .HasColumnType("int"); diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250818153349_remove-pageresource-script.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250818153349_remove-pageresource-script.Designer.cs new file mode 100644 index 000000000..ef0f7a6af --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250818153349_remove-pageresource-script.Designer.cs @@ -0,0 +1,964 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using cloudscribe.SimpleContent.Storage.EFCore.MySQL; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.MySQL.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250818153349_remove-pageresource-script")] + partial class removepageresourcescript + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("char(36)"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ArchivedUtc") + .HasColumnType("datetime(6)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CategoriesCsv") + .HasColumnType("longtext"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime(6)"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DraftContent") + .HasColumnType("longtext"); + + b.Property("DraftPubDate") + .HasColumnType("datetime(6)"); + + b.Property("DraftSerializedModel") + .HasColumnType("longtext"); + + b.Property("IsDraftHx") + .HasColumnType("tinyint(1)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("LastModified") + .HasColumnType("datetime(6)"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("MetaDescription") + .HasColumnType("longtext"); + + b.Property("MetaHtml") + .HasColumnType("longtext"); + + b.Property("MetaJson") + .HasColumnType("longtext"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("SerializedModel") + .HasColumnType("longtext"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ShowCreatedBy") + .HasColumnType("tinyint(1)"); + + b.Property("ShowCreatedDate") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("tinyint(1)"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("TeaserOverride") + .HasColumnType("longtext"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ViewRoles") + .HasColumnType("longtext"); + + b.Property("WasDeleted") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.HasIndex("ContentSource"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("CreatedByUser"); + + b.HasIndex("LastModifiedByUser"); + + b.HasIndex("Title"); + + b.ToTable("cs_ContentHistory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("AboutContent") + .HasColumnType("longtext"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("tinyint(1)"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("tinyint(1)"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("BlogPagePosition") + .HasColumnType("int"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("ChannelTimeToLive") + .HasColumnType("int"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DaysToComment") + .HasColumnType("int"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValue("html"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(20); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("tinyint(1)"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1000); + + b.Property("ModerateComments") + .HasColumnType("tinyint(1)"); + + b.Property("PostsPerPage") + .HasColumnType("int"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("varchar(75)"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("varchar(20)"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("varchar(20)"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ShowAboutBox") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ShowArchivedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ShowBlogCategories") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ShowCreatedBy") + .HasColumnType("tinyint(1)"); + + b.Property("ShowCreatedDate") + .HasColumnType("tinyint(1)"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("tinyint(1)"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("tinyint(1)"); + + b.Property("ShowRelatedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ShowTitle") + .HasColumnType("tinyint(1)"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint unsigned") + .HasDefaultValue((byte)0); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(20); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint unsigned") + .HasDefaultValue((byte)0); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("tinyint(1)"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.HasKey("Id"); + + b.ToTable("cs_ContentProject", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Value", "PageEntityId"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PageCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PageComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime(6)"); + + b.Property("DisableEditor") + .HasColumnType("tinyint(1)"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DraftContent") + .HasColumnType("longtext"); + + b.Property("DraftPubDate") + .HasColumnType("datetime(6)"); + + b.Property("DraftSerializedModel") + .HasColumnType("longtext"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("LastModified") + .HasColumnType("datetime(6)"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("MenuOnly") + .HasColumnType("tinyint(1)"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("MetaHtml") + .HasColumnType("longtext"); + + b.Property("MetaJson") + .HasColumnType("longtext"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("Script") + .HasColumnType("longtext"); + + b.Property("SerializedModel") + .HasColumnType("longtext"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ShowCategories") + .HasColumnType("tinyint(1)"); + + b.Property("ShowComments") + .HasColumnType("tinyint(1)"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + + b.Property("ShowHeading") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModified") + .HasColumnType("tinyint(1)"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + + b.Property("ShowMenu") + .HasColumnType("tinyint(1)"); + + b.Property("ShowPubDate") + .HasColumnType("tinyint(1)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ViewRoles") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_Page", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("varchar(15)"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Sort") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.ToTable("cs_PageResource", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Value", "PostEntityId"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PostCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PostComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("AutoTeaser") + .HasColumnType("longtext"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("Content") + .HasColumnType("longtext"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedUtc") + .HasColumnType("datetime(6)"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DraftContent") + .HasColumnType("longtext"); + + b.Property("DraftPubDate") + .HasColumnType("datetime(6)"); + + b.Property("DraftSerializedModel") + .HasColumnType("longtext"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("IsFeatured") + .HasColumnType("tinyint(1)"); + + b.Property("IsPublished") + .HasColumnType("tinyint(1)"); + + b.Property("LastModified") + .HasColumnType("datetime(6)"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("MetaHtml") + .HasColumnType("longtext"); + + b.Property("MetaJson") + .HasColumnType("longtext"); + + b.Property("PubDate") + .HasColumnType("datetime(6)"); + + b.Property("Script") + .HasColumnType("longtext"); + + b.Property("SerializedModel") + .HasColumnType("longtext"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ShowComments") + .HasColumnType("bit"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("SuppressTeaser") + .HasColumnType("tinyint(1)"); + + b.Property("TeaserOverride") + .HasColumnType("longtext"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("Slug"); + + b.ToTable("cs_Post", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250818153349_remove-pageresource-script.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250818153349_remove-pageresource-script.cs new file mode 100644 index 000000000..5438f0bb2 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/20250818153349_remove-pageresource-script.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.MySQL.Migrations +{ + /// + public partial class removepageresourcescript : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Script", + table: "cs_PageResource"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Script", + table: "cs_PageResource", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/SimpleContentDbContextModelSnapshot.cs index ba51720cf..475f35ae9 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.MySQL/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -686,9 +686,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("varchar(36)"); - b.Property("Script") - .HasColumnType("longtext"); - b.Property("Sort") .HasColumnType("int"); diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250818153117_remove-pageresource-script.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250818153117_remove-pageresource-script.Designer.cs new file mode 100644 index 000000000..b57cd026d --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250818153117_remove-pageresource-script.Designer.cs @@ -0,0 +1,1215 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using cloudscribe.SimpleContent.Storage.EFCore.PostgreSql; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.PostgreSql.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250818153117_remove-pageresource-script")] + partial class removepageresourcescript + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("archived_by"); + + b.Property("ArchivedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("archived_utc"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("CategoriesCsv") + .HasColumnType("text") + .HasColumnName("categories_csv"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("content_id"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("content_source"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html") + .HasColumnName("content_type"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("correlation_key"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("created_by_user"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_utc"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("draft_author"); + + b.Property("DraftContent") + .HasColumnType("text") + .HasColumnName("draft_content"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("draft_pub_date"); + + b.Property("DraftSerializedModel") + .HasColumnType("text") + .HasColumnName("draft_serialized_model"); + + b.Property("IsDraftHx") + .HasColumnType("boolean") + .HasColumnName("is_draft_hx"); + + b.Property("IsPublished") + .HasColumnType("boolean") + .HasColumnName("is_published"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_modified"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("last_modified_by_user"); + + b.Property("MetaDescription") + .HasColumnType("text") + .HasColumnName("meta_description"); + + b.Property("MetaHtml") + .HasColumnType("text") + .HasColumnName("meta_html"); + + b.Property("MetaJson") + .HasColumnType("text") + .HasColumnName("meta_json"); + + b.Property("PageOrder") + .HasColumnType("integer") + .HasColumnName("page_order"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("parent_id"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("parent_slug"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("SerializedModel") + .HasColumnType("text") + .HasColumnName("serialized_model"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("serializer"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean") + .HasColumnName("show_created_by"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean") + .HasColumnName("show_created_date"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_by"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_date"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("slug"); + + b.Property("TeaserOverride") + .HasColumnType("text") + .HasColumnName("teaser_override"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("template_key"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("title"); + + b.Property("ViewRoles") + .HasColumnType("text") + .HasColumnName("view_roles"); + + b.Property("WasDeleted") + .HasColumnType("boolean") + .HasColumnName("was_deleted"); + + b.HasKey("Id") + .HasName("pk_cs_content_history"); + + b.HasIndex("ContentId") + .HasDatabaseName("ix_cs_content_history_content_id"); + + b.HasIndex("ContentSource") + .HasDatabaseName("ix_cs_content_history_content_source"); + + b.HasIndex("CorrelationKey") + .HasDatabaseName("ix_cs_content_history_correlation_key"); + + b.HasIndex("CreatedByUser") + .HasDatabaseName("ix_cs_content_history_created_by_user"); + + b.HasIndex("LastModifiedByUser") + .HasDatabaseName("ix_cs_content_history_last_modified_by_user"); + + b.HasIndex("Title") + .HasDatabaseName("ix_cs_content_history_title"); + + b.ToTable("cs_content_history", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("id"); + + b.Property("AboutContent") + .HasColumnType("text") + .HasColumnName("about_content"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("about_heading"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("boolean") + .HasColumnName("add_blog_to_pages_tree"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("boolean") + .HasColumnName("blog_menu_links_to_newest_post"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("blog_page_nav_component_visibility"); + + b.Property("BlogPagePosition") + .HasColumnType("integer") + .HasColumnName("blog_page_position"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("blog_page_text"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("cdn_url"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("channel_categories_csv"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("channel_rating"); + + b.Property("ChannelTimeToLive") + .HasColumnType("integer") + .HasColumnName("channel_time_to_live"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("comment_notification_email"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("copyright_notice"); + + b.Property("DaysToComment") + .HasColumnType("integer") + .HasColumnName("days_to_comment"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html") + .HasColumnName("default_content_type"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(20) + .HasColumnName("default_feed_items"); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("default_page_slug"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("disqus_short_name"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("facebook_app_id"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("image"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("boolean") + .HasColumnName("include_pub_date_in_post_urls"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("character varying(10)") + .HasColumnName("language_code"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("local_media_virtual_path"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("managing_editor_email"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1000) + .HasColumnName("max_feed_items"); + + b.Property("ModerateComments") + .HasColumnType("boolean") + .HasColumnName("moderate_comments"); + + b.Property("PostsPerPage") + .HasColumnType("integer") + .HasColumnName("posts_per_page"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("character varying(75)") + .HasColumnName("pub_date_format"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("publisher"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("publisher_entity_type"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasColumnName("publisher_logo_height"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("publisher_logo_url"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasColumnName("publisher_logo_width"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("recaptcha_private_key"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("recaptcha_public_key"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("remote_feed_processor_use_agent_fragment"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("remote_feed_url"); + + b.Property("ShowAboutBox") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("show_about_box"); + + b.Property("ShowArchivedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("show_archived_posts"); + + b.Property("ShowBlogCategories") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("show_blog_categories"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean") + .HasColumnName("show_created_by"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean") + .HasColumnName("show_created_date"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("boolean") + .HasColumnName("show_featured_posts_on_default_page"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_by"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_date"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("boolean") + .HasColumnName("show_recent_posts_on_default_page"); + + b.Property("ShowRelatedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true) + .HasColumnName("show_related_posts"); + + b.Property("ShowTitle") + .HasColumnType("boolean") + .HasColumnName("show_title"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("site_name"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)0) + .HasColumnName("teaser_mode"); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(20) + .HasColumnName("teaser_truncation_length"); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)0) + .HasColumnName("teaser_truncation_mode"); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("time_zone_id"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("title"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("twitter_creator"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("twitter_publisher"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("boolean") + .HasColumnName("use_default_page_as_root_node"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("webmaster_email"); + + b.HasKey("Id") + .HasName("pk_cs_content_project"); + + b.ToTable("cs_content_project", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("value"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("page_entity_id"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.HasKey("Value", "PageEntityId") + .HasName("pk_cs_page_category"); + + b.HasIndex("PageEntityId") + .HasDatabaseName("ix_cs_page_category_page_entity_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_page_category_project_id"); + + b.HasIndex("Value") + .HasDatabaseName("ix_cs_page_category_value"); + + b.ToTable("cs_page_category", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("email"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("ip"); + + b.Property("IsAdmin") + .HasColumnType("boolean") + .HasColumnName("is_admin"); + + b.Property("IsApproved") + .HasColumnType("boolean") + .HasColumnName("is_approved"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("page_entity_id"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("user_agent"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_cs_page_comment"); + + b.HasIndex("PageEntityId") + .HasDatabaseName("ix_cs_page_comment_page_entity_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_page_comment_project_id"); + + b.ToTable("cs_page_comment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("categories_csv"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html") + .HasColumnName("content_type"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("correlation_key"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("created_by_user"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_utc"); + + b.Property("DisableEditor") + .HasColumnType("boolean") + .HasColumnName("disable_editor"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("draft_author"); + + b.Property("DraftContent") + .HasColumnType("text") + .HasColumnName("draft_content"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("draft_pub_date"); + + b.Property("DraftSerializedModel") + .HasColumnType("text") + .HasColumnName("draft_serialized_model"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("external_url"); + + b.Property("IsPublished") + .HasColumnType("boolean") + .HasColumnName("is_published"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_modified"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("last_modified_by_user"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("menu_filters"); + + b.Property("MenuOnly") + .HasColumnType("boolean") + .HasColumnName("menu_only"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("meta_description"); + + b.Property("MetaHtml") + .HasColumnType("text") + .HasColumnName("meta_html"); + + b.Property("MetaJson") + .HasColumnType("text") + .HasColumnName("meta_json"); + + b.Property("PageOrder") + .HasColumnType("integer") + .HasColumnName("page_order"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("parent_id"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("parent_slug"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("Script") + .HasColumnType("text") + .HasColumnName("script"); + + b.Property("SerializedModel") + .HasColumnType("text") + .HasColumnName("serialized_model"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("serializer"); + + b.Property("ShowCategories") + .HasColumnType("boolean") + .HasColumnName("show_categories"); + + b.Property("ShowComments") + .HasColumnType("boolean") + .HasColumnName("show_comments"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean") + .HasColumnName("show_created_by"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean") + .HasColumnName("show_created_date"); + + b.Property("ShowHeading") + .HasColumnType("boolean") + .HasColumnName("show_heading"); + + b.Property("ShowLastModified") + .HasColumnType("boolean") + .HasColumnName("show_last_modified"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_by"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean") + .HasColumnName("show_last_modified_date"); + + b.Property("ShowMenu") + .HasColumnType("boolean") + .HasColumnName("show_menu"); + + b.Property("ShowPubDate") + .HasColumnType("boolean") + .HasColumnName("show_pub_date"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("slug"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("template_key"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("title"); + + b.Property("ViewRoles") + .HasColumnType("text") + .HasColumnName("view_roles"); + + b.HasKey("Id") + .HasName("pk_cs_page"); + + b.HasIndex("CorrelationKey") + .HasDatabaseName("ix_cs_page_correlation_key"); + + b.HasIndex("ParentId") + .HasDatabaseName("ix_cs_page_parent_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_page_project_id"); + + b.ToTable("cs_page", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("character varying(15)") + .HasColumnName("environment"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("page_entity_id"); + + b.Property("Sort") + .HasColumnType("integer") + .HasColumnName("sort"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("character varying(10)") + .HasColumnName("type"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("url"); + + b.HasKey("Id") + .HasName("pk_cs_page_resource"); + + b.HasIndex("PageEntityId") + .HasDatabaseName("ix_cs_page_resource_page_entity_id"); + + b.ToTable("cs_page_resource", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("value"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("post_entity_id"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.HasKey("Value", "PostEntityId") + .HasName("pk_cs_post_category"); + + b.HasIndex("PostEntityId") + .HasDatabaseName("ix_cs_post_category_post_entity_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_post_category_project_id"); + + b.HasIndex("Value") + .HasDatabaseName("ix_cs_post_category_value"); + + b.ToTable("cs_post_category", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("email"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("ip"); + + b.Property("IsAdmin") + .HasColumnType("boolean") + .HasColumnName("is_admin"); + + b.Property("IsApproved") + .HasColumnType("boolean") + .HasColumnName("is_approved"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("post_entity_id"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("project_id"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("user_agent"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("website"); + + b.HasKey("Id") + .HasName("pk_cs_post_comment"); + + b.HasIndex("PostEntityId") + .HasDatabaseName("ix_cs_post_comment_post_entity_id"); + + b.HasIndex("ProjectId") + .HasDatabaseName("ix_cs_post_comment_project_id"); + + b.ToTable("cs_post_comment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("character varying(36)") + .HasColumnName("id"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("author"); + + b.Property("AutoTeaser") + .HasColumnType("text") + .HasColumnName("auto_teaser"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("blog_id"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("categories_csv"); + + b.Property("Content") + .HasColumnType("text") + .HasColumnName("content"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasDefaultValue("html") + .HasColumnName("content_type"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("correlation_key"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("created_by_user"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_utc"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("draft_author"); + + b.Property("DraftContent") + .HasColumnType("text") + .HasColumnName("draft_content"); + + b.Property("DraftPubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("draft_pub_date"); + + b.Property("DraftSerializedModel") + .HasColumnType("text") + .HasColumnName("draft_serialized_model"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("character varying(250)") + .HasColumnName("image_url"); + + b.Property("IsFeatured") + .HasColumnType("boolean") + .HasColumnName("is_featured"); + + b.Property("IsPublished") + .HasColumnType("boolean") + .HasColumnName("is_published"); + + b.Property("LastModified") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_modified"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("last_modified_by_user"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("meta_description"); + + b.Property("MetaHtml") + .HasColumnType("text") + .HasColumnName("meta_html"); + + b.Property("MetaJson") + .HasColumnType("text") + .HasColumnName("meta_json"); + + b.Property("PubDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("pub_date"); + + b.Property("Script") + .HasColumnType("text") + .HasColumnName("script"); + + b.Property("SerializedModel") + .HasColumnType("text") + .HasColumnName("serialized_model"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("serializer"); + + b.Property("ShowComments") + .HasColumnType("boolean") + .HasColumnName("show_comments"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("slug"); + + b.Property("SuppressTeaser") + .HasColumnType("boolean") + .HasColumnName("suppress_teaser"); + + b.Property("TeaserOverride") + .HasColumnType("text") + .HasColumnName("teaser_override"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("template_key"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("character varying(250)") + .HasColumnName("thumbnail_url"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("title"); + + b.HasKey("Id") + .HasName("pk_cs_post"); + + b.HasIndex("BlogId") + .HasDatabaseName("ix_cs_post_blog_id"); + + b.HasIndex("CorrelationKey") + .HasDatabaseName("ix_cs_post_correlation_key"); + + b.HasIndex("Slug") + .HasDatabaseName("ix_cs_post_slug"); + + b.ToTable("cs_post", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_cs_page_comment_cs_page_page_entity_id"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_cs_page_resource_cs_page_page_entity_id"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId") + .HasConstraintName("fk_cs_post_comment_cs_post_post_entity_id"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250818153117_remove-pageresource-script.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250818153117_remove-pageresource-script.cs new file mode 100644 index 000000000..f17d6e3d7 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/20250818153117_remove-pageresource-script.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.PostgreSql.Migrations +{ + /// + public partial class removepageresourcescript : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "script", + table: "cs_page_resource"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "script", + table: "cs_page_resource", + type: "text", + nullable: true); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/SimpleContentDbContextModelSnapshot.cs index c9fdb2b74..f3044214c 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.PostgreSql/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -870,10 +870,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(36)") .HasColumnName("page_entity_id"); - b.Property("Script") - .HasColumnType("text") - .HasColumnName("script"); - b.Property("Sort") .HasColumnType("integer") .HasColumnName("sort"); diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250818153135_remove-pageresource-script.Designer.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250818153135_remove-pageresource-script.Designer.cs new file mode 100644 index 000000000..82e4a1c4f --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250818153135_remove-pageresource-script.Designer.cs @@ -0,0 +1,962 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using cloudscribe.SimpleContent.Storage.EFCore.SQLite; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.SQLite.Migrations +{ + [DbContext(typeof(SimpleContentDbContext))] + [Migration("20250818153135_remove-pageresource-script")] + partial class removepageresourcescript + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.0"); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ContentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ArchivedBy") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ArchivedUtc") + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CategoriesCsv") + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("ContentId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ContentSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("TEXT"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("DraftContent") + .HasColumnType("TEXT"); + + b.Property("DraftPubDate") + .HasColumnType("TEXT"); + + b.Property("DraftSerializedModel") + .HasColumnType("TEXT"); + + b.Property("IsDraftHx") + .HasColumnType("INTEGER"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("LastModified") + .HasColumnType("TEXT"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("MetaDescription") + .HasColumnType("TEXT"); + + b.Property("MetaHtml") + .HasColumnType("TEXT"); + + b.Property("MetaJson") + .HasColumnType("TEXT"); + + b.Property("PageOrder") + .HasColumnType("INTEGER"); + + b.Property("ParentId") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("SerializedModel") + .HasColumnType("TEXT"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ShowCreatedBy") + .HasColumnType("INTEGER"); + + b.Property("ShowCreatedDate") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("INTEGER"); + + b.Property("Slug") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("TeaserOverride") + .HasColumnType("TEXT"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ViewRoles") + .HasColumnType("TEXT"); + + b.Property("WasDeleted") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ContentId"); + + b.HasIndex("ContentSource"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("CreatedByUser"); + + b.HasIndex("LastModifiedByUser"); + + b.HasIndex("Title"); + + b.ToTable("cs_ContentHistory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Models.ProjectSettings", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("AboutContent") + .HasColumnType("TEXT"); + + b.Property("AboutHeading") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("AddBlogToPagesTree") + .HasColumnType("INTEGER"); + + b.Property("BlogMenuLinksToNewestPost") + .HasColumnType("INTEGER"); + + b.Property("BlogPageNavComponentVisibility") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("BlogPagePosition") + .HasColumnType("INTEGER"); + + b.Property("BlogPageText") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CdnUrl") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ChannelCategoriesCsv") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ChannelRating") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ChannelTimeToLive") + .HasColumnType("INTEGER"); + + b.Property("CommentNotificationEmail") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CopyrightNotice") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("DaysToComment") + .HasColumnType("INTEGER"); + + b.Property("DefaultContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasDefaultValue("html"); + + b.Property("DefaultFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(20); + + b.Property("DefaultPageSlug") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DisqusShortName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("FacebookAppId") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Image") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("IncludePubDateInPostUrls") + .HasColumnType("INTEGER"); + + b.Property("LanguageCode") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("LocalMediaVirtualPath") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ManagingEditorEmail") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("MaxFeedItems") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(1000); + + b.Property("ModerateComments") + .HasColumnType("INTEGER"); + + b.Property("PostsPerPage") + .HasColumnType("INTEGER"); + + b.Property("PubDateFormat") + .HasMaxLength(75) + .HasColumnType("TEXT"); + + b.Property("Publisher") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("PublisherEntityType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PublisherLogoHeight") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("PublisherLogoUrl") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("PublisherLogoWidth") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("RecaptchaPrivateKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("RecaptchaPublicKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("RemoteFeedProcessorUseAgentFragment") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("RemoteFeedUrl") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ShowAboutBox") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ShowArchivedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ShowBlogCategories") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ShowCreatedBy") + .HasColumnType("INTEGER"); + + b.Property("ShowCreatedDate") + .HasColumnType("INTEGER"); + + b.Property("ShowFeaturedPostsOnDefaultPage") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("INTEGER"); + + b.Property("ShowRecentPostsOnDefaultPage") + .HasColumnType("INTEGER"); + + b.Property("ShowRelatedPosts") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ShowTitle") + .HasColumnType("INTEGER"); + + b.Property("SiteName") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("TeaserMode") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue((byte)0); + + b.Property("TeaserTruncationLength") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(20); + + b.Property("TeaserTruncationMode") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue((byte)0); + + b.Property("TimeZoneId") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("TwitterCreator") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("TwitterPublisher") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("UseDefaultPageAsRootNode") + .HasColumnType("INTEGER"); + + b.Property("WebmasterEmail") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("cs_ContentProject", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Value", "PageEntityId"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PageCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsAdmin") + .HasColumnType("INTEGER"); + + b.Property("IsApproved") + .HasColumnType("INTEGER"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PageComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("TEXT"); + + b.Property("DisableEditor") + .HasColumnType("INTEGER"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("DraftContent") + .HasColumnType("TEXT"); + + b.Property("DraftPubDate") + .HasColumnType("TEXT"); + + b.Property("DraftSerializedModel") + .HasColumnType("TEXT"); + + b.Property("ExternalUrl") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("LastModified") + .HasColumnType("TEXT"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("MenuFilters") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MenuOnly") + .HasColumnType("INTEGER"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MetaHtml") + .HasColumnType("TEXT"); + + b.Property("MetaJson") + .HasColumnType("TEXT"); + + b.Property("PageOrder") + .HasColumnType("INTEGER"); + + b.Property("ParentId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ParentSlug") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("Script") + .HasColumnType("TEXT"); + + b.Property("SerializedModel") + .HasColumnType("TEXT"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ShowCategories") + .HasColumnType("INTEGER"); + + b.Property("ShowComments") + .HasColumnType("INTEGER"); + + b.Property("ShowCreatedBy") + .HasColumnType("boolean"); + + b.Property("ShowCreatedDate") + .HasColumnType("boolean"); + + b.Property("ShowHeading") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModified") + .HasColumnType("INTEGER"); + + b.Property("ShowLastModifiedBy") + .HasColumnType("boolean"); + + b.Property("ShowLastModifiedDate") + .HasColumnType("boolean"); + + b.Property("ShowMenu") + .HasColumnType("INTEGER"); + + b.Property("ShowPubDate") + .HasColumnType("INTEGER"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ViewRoles") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_Page", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Environment") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("TEXT"); + + b.Property("PageEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Sort") + .HasColumnType("INTEGER"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PageEntityId"); + + b.ToTable("cs_PageResource", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostCategory", b => + { + b.Property("Value") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Value", "PostEntityId"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("Value"); + + b.ToTable("cs_PostCategory", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Ip") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("IsAdmin") + .HasColumnType("INTEGER"); + + b.Property("IsApproved") + .HasColumnType("INTEGER"); + + b.Property("PostEntityId") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("UserAgent") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Website") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("PostEntityId"); + + b.HasIndex("ProjectId"); + + b.ToTable("cs_PostComment", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("TEXT"); + + b.Property("Author") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("AutoTeaser") + .HasColumnType("TEXT"); + + b.Property("BlogId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CategoriesCsv") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasDefaultValue("html"); + + b.Property("CorrelationKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("CreatedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("TEXT"); + + b.Property("DraftAuthor") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("DraftContent") + .HasColumnType("TEXT"); + + b.Property("DraftPubDate") + .HasColumnType("TEXT"); + + b.Property("DraftSerializedModel") + .HasColumnType("TEXT"); + + b.Property("ImageUrl") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("IsFeatured") + .HasColumnType("INTEGER"); + + b.Property("IsPublished") + .HasColumnType("INTEGER"); + + b.Property("LastModified") + .HasColumnType("TEXT"); + + b.Property("LastModifiedByUser") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("MetaDescription") + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("MetaHtml") + .HasColumnType("TEXT"); + + b.Property("MetaJson") + .HasColumnType("TEXT"); + + b.Property("PubDate") + .HasColumnType("TEXT"); + + b.Property("Script") + .HasColumnType("TEXT"); + + b.Property("SerializedModel") + .HasColumnType("TEXT"); + + b.Property("Serializer") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ShowComments") + .HasColumnType("INTEGER"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("SuppressTeaser") + .HasColumnType("INTEGER"); + + b.Property("TeaserOverride") + .HasColumnType("TEXT"); + + b.Property("TemplateKey") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ThumbnailUrl") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("BlogId"); + + b.HasIndex("CorrelationKey"); + + b.HasIndex("Slug"); + + b.ToTable("cs_Post", (string)null); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageComments") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageResourceEntity", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", null) + .WithMany("PageResources") + .HasForeignKey("PageEntityId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostComment", b => + { + b.HasOne("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", null) + .WithMany("PostComments") + .HasForeignKey("PostEntityId"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PageEntity", b => + { + b.Navigation("PageComments"); + + b.Navigation("PageResources"); + }); + + modelBuilder.Entity("cloudscribe.SimpleContent.Storage.EFCore.Models.PostEntity", b => + { + b.Navigation("PostComments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250818153135_remove-pageresource-script.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250818153135_remove-pageresource-script.cs new file mode 100644 index 000000000..b791c2342 --- /dev/null +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/20250818153135_remove-pageresource-script.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace cloudscribe.SimpleContent.Storage.EFCore.SQLite.Migrations +{ + /// + public partial class removepageresourcescript : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Script", + table: "cs_PageResource"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Script", + table: "cs_PageResource", + type: "TEXT", + nullable: true); + } + } +} diff --git a/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/SimpleContentDbContextModelSnapshot.cs b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/SimpleContentDbContextModelSnapshot.cs index 987a09d1e..9dcbc2227 100644 --- a/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/SimpleContentDbContextModelSnapshot.cs +++ b/src/cloudscribe.SimpleContent.Storage.EFCore.SQLite/Migrations/SimpleContentDbContextModelSnapshot.cs @@ -684,9 +684,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("TEXT"); - b.Property("Script") - .HasColumnType("TEXT"); - b.Property("Sort") .HasColumnType("INTEGER"); diff --git a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs index 138f4fd52..d187c6f9e 100644 --- a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs +++ b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs @@ -853,7 +853,6 @@ public virtual async Task Development(CancellationToken cancellat Script = invalidScript ?? editContext.CurrentPage.Script }; model.AddResourceViewModel.Slug = editContext.CurrentPage.Slug; - model.AddResourceViewModel.Script = invalidScript ?? editContext.CurrentPage.Script; model.Css = editContext.CurrentPage.Resources.Where(x => x.Type == "css").OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList(); model.Js = editContext.CurrentPage.Resources.Where(x => x.Type == "js").OrderBy(x => x.Sort).ThenBy(x => x.Url).ToList(); @@ -908,8 +907,7 @@ public virtual async Task AddResource(AddPageResourceViewModel mo Type = model.Type, Environment = model.Environment, Sort = model.Sort, - Url = model.Url, - Script = model.Script + Url = model.Url }; editContext.CurrentPage.Resources.Add(resource); @@ -921,7 +919,7 @@ public virtual async Task AddResource(AddPageResourceViewModel mo [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] - public virtual async Task AddScriptResource(PageEditViewModel model) + public virtual async Task AddScriptResource(PageDevelopmentViewModel model) { var editContextRequest = new PageEditContextRequest(User, model.Slug, null, model.Script, null); var editContext = await Mediator.Send(editContextRequest); diff --git a/src/cloudscribe.SimpleContent.Web/ViewModels/AddPageResourceViewModel.cs b/src/cloudscribe.SimpleContent.Web/ViewModels/AddPageResourceViewModel.cs index c37a73551..05506779d 100644 --- a/src/cloudscribe.SimpleContent.Web/ViewModels/AddPageResourceViewModel.cs +++ b/src/cloudscribe.SimpleContent.Web/ViewModels/AddPageResourceViewModel.cs @@ -18,12 +18,6 @@ public class AddPageResourceViewModel //[DataType(DataType.Url)] [RegularExpression(@"^(http(s)?://)?(\/?)[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-‌​\.\?\,\'\/\\\+&%\$#_]*)?$", ErrorMessage ="Please provide a valid url or relative url")] public string Url { get; set; } - public string Script { get; set; } } - public class AddPageResourceViewModelScriptOnly - { - public string Slug { get; set; } - public string Script { get; set; } - } } From 8685977137452ff3f723966f19ad08353ff6b761 Mon Sep 17 00:00:00 2001 From: Jim Kerslake <39943820+JimKerslake@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:15:52 +0100 Subject: [PATCH 11/11] #482 alerts on success --- .../Controllers/PageController.cs | 2 ++ .../GlobalResources/SimpleContent.en-US.resx | 6 ++++++ src/sourceDev.WebApp/GlobalResources/SimpleContent.resx | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs index d187c6f9e..f27700476 100644 --- a/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs +++ b/src/cloudscribe.SimpleContent.Web/Controllers/PageController.cs @@ -989,6 +989,8 @@ public virtual async Task AddScriptResource(PageDevelopmentViewMo editContext.CurrentPage.Script = model.Script; await PageService.Update(editContext.CurrentPage); + + this.AlertSuccess(StringLocalizer["Script saved successfully"], true); return RedirectToRoute(PageRoutes.PageDevelopRouteName, new { slug = editContext.CurrentPage.Slug }); } diff --git a/src/sourceDev.WebApp/GlobalResources/SimpleContent.en-US.resx b/src/sourceDev.WebApp/GlobalResources/SimpleContent.en-US.resx index 6c418154c..f6e2a28ce 100644 --- a/src/sourceDev.WebApp/GlobalResources/SimpleContent.en-US.resx +++ b/src/sourceDev.WebApp/GlobalResources/SimpleContent.en-US.resx @@ -645,4 +645,10 @@ Version History + + Script saved successfully + + + Script cleared successfully + \ No newline at end of file diff --git a/src/sourceDev.WebApp/GlobalResources/SimpleContent.resx b/src/sourceDev.WebApp/GlobalResources/SimpleContent.resx index 6c418154c..f6e2a28ce 100644 --- a/src/sourceDev.WebApp/GlobalResources/SimpleContent.resx +++ b/src/sourceDev.WebApp/GlobalResources/SimpleContent.resx @@ -645,4 +645,10 @@ Version History + + Script saved successfully + + + Script cleared successfully + \ No newline at end of file