From 627f1ed3ce55659bdb0964b7bd0881034cd42f22 Mon Sep 17 00:00:00 2001 From: thisisnabi Date: Thu, 6 Jun 2024 13:26:44 +0330 Subject: [PATCH] Fix Article ReadOn time --- .../ArticleAggregate/Article.cs | 2 +- .../Persistence/BloggerDbContextFactory.cs | 6 +- ...0240418134412_InitialDbContext.Designer.cs | 382 ----------------- .../20240418134412_InitialDbContext.cs | 203 --------- ...4724_AddMaxLenForArticleAuthor.Designer.cs | 385 ----------------- ...0240418134724_AddMaxLenForArticleAuthor.cs | 78 ---- ...8135132_ChangeSubscriberIdsKey.Designer.cs | 381 ----------------- .../20240418135132_ChangeSubscriberIdsKey.cs | 83 ---- ...333_ChangeArticleCommandIdsKey.Designer.cs | 379 ----------------- ...240418135333_ChangeArticleCommandIdsKey.cs | 65 --- ...18135617_ChangeForeignKeysName.Designer.cs | 381 ----------------- .../20240418135617_ChangeForeignKeysName.cs | 42 -- ...8135859_ChangeForeignKeArticle.Designer.cs | 385 ----------------- .../20240418135859_ChangeForeignKeArticle.cs | 83 ---- ..._ChangeForeignKeArticleComment.Designer.cs | 387 ------------------ ...418140031_ChangeForeignKeArticleComment.cs | 65 --- ...3133_ChangePublidhedToNullable.Designer.cs | 387 ------------------ ...0240419173133_ChangePublidhedToNullable.cs | 39 -- .../BloggerDbContextModelSnapshot.cs | 384 ----------------- 19 files changed, 2 insertions(+), 4115 deletions(-) delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418134412_InitialDbContext.Designer.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418134412_InitialDbContext.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418134724_AddMaxLenForArticleAuthor.Designer.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418134724_AddMaxLenForArticleAuthor.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418135132_ChangeSubscriberIdsKey.Designer.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418135132_ChangeSubscriberIdsKey.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418135333_ChangeArticleCommandIdsKey.Designer.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418135333_ChangeArticleCommandIdsKey.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418135617_ChangeForeignKeysName.Designer.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418135617_ChangeForeignKeysName.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418135859_ChangeForeignKeArticle.Designer.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418135859_ChangeForeignKeArticle.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418140031_ChangeForeignKeArticleComment.Designer.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240418140031_ChangeForeignKeArticleComment.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240419173133_ChangePublidhedToNullable.Designer.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/20240419173133_ChangePublidhedToNullable.cs delete mode 100644 src/Blogger.Infrastructure/Persistence/Migrations/BloggerDbContextModelSnapshot.cs diff --git a/src/Blogger.Domain/ArticleAggregate/Article.cs b/src/Blogger.Domain/ArticleAggregate/Article.cs index 6d46aba..9820e2b 100644 --- a/src/Blogger.Domain/ArticleAggregate/Article.cs +++ b/src/Blogger.Domain/ArticleAggregate/Article.cs @@ -71,7 +71,7 @@ private static TimeSpan GetReadOnTimeSpan(string body) return TimeSpan.Zero; } - var words = body.Split([ ' ', '\t', '\n', '\r' ], StringSplitOptions.RemoveEmptyEntries).Length; + var words = body.Split(' ', '\t', '\n', '\r').Length; var readingTimeMinutes = words / 200.0; return TimeSpan.FromMinutes(readingTimeMinutes); } diff --git a/src/Blogger.Infrastructure/Persistence/BloggerDbContextFactory.cs b/src/Blogger.Infrastructure/Persistence/BloggerDbContextFactory.cs index 1f069ee..1efa4df 100644 --- a/src/Blogger.Infrastructure/Persistence/BloggerDbContextFactory.cs +++ b/src/Blogger.Infrastructure/Persistence/BloggerDbContextFactory.cs @@ -1,8 +1,4 @@ -using Blogger.Domain.ArticleAggregate; -using Blogger.Domain.CommentAggregate; -using Blogger.Domain.SubscriberAggregate; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Design; +using Microsoft.EntityFrameworkCore.Design; namespace Blogger.Infrastructure.Persistence; public class BloggerDbContextFactory : IDesignTimeDbContextFactory diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418134412_InitialDbContext.Designer.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418134412_InitialDbContext.Designer.cs deleted file mode 100644 index 870fa5b..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418134412_InitialDbContext.Designer.cs +++ /dev/null @@ -1,382 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - [Migration("20240418134412_InitialDbContext")] - partial class InitialDbContext - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .HasColumnType("uniqueidentifier"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("SubscriberId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("SubscriberId", "Id"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418134412_InitialDbContext.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418134412_InitialDbContext.cs deleted file mode 100644 index 6e0315c..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418134412_InitialDbContext.cs +++ /dev/null @@ -1,203 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - /// - public partial class InitialDbContext : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.EnsureSchema( - name: "blog"); - - migrationBuilder.CreateTable( - name: "Articles", - schema: "blog", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - Author_FullName = table.Column(type: "nvarchar(max)", nullable: false), - Author_Avatar = table.Column(type: "nvarchar(max)", nullable: false), - Author_JobTitle = table.Column(type: "nvarchar(max)", nullable: false), - Title = table.Column(type: "varchar(70)", unicode: false, maxLength: 70, nullable: false), - Body = table.Column(type: "nvarchar(max)", nullable: false), - Summary = table.Column(type: "varchar(300)", unicode: false, maxLength: 300, nullable: false), - PublishedOnUtc = table.Column(type: "datetime2", nullable: true), - Status = table.Column(type: "int", nullable: false), - ReadOn = table.Column(type: "time", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Articles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Comments", - schema: "blog", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Client_FullName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Client_Email = table.Column(type: "nvarchar(1044)", maxLength: 1044, nullable: false), - ApproveLink_ApproveId = table.Column(type: "nvarchar(2077)", maxLength: 2077, nullable: false), - ApproveLink_ApproveExpirationOnUtc = table.Column(type: "datetime2", nullable: false), - ArticleId = table.Column(type: "nvarchar(max)", nullable: false), - CreatedOnUtc = table.Column(type: "datetime2", nullable: false), - Content = table.Column(type: "varchar(500)", unicode: false, maxLength: 500, nullable: false), - IsApproved = table.Column(type: "bit", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Comments", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Subscribers", - schema: "blog", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - JoinedOnUtc = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Subscribers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ArticleCommentIds", - schema: "blog", - columns: table => new - { - ArticleId = table.Column(type: "nvarchar(450)", nullable: false), - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Value = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ArticleCommentIds", x => new { x.ArticleId, x.Id }); - table.ForeignKey( - name: "FK_ArticleCommentIds_Articles_ArticleId", - column: x => x.ArticleId, - principalSchema: "blog", - principalTable: "Articles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Tags", - schema: "blog", - columns: table => new - { - ArticleId = table.Column(type: "nvarchar(450)", nullable: false), - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Value = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Tags", x => new { x.ArticleId, x.Id }); - table.ForeignKey( - name: "FK_Tags_Articles_ArticleId", - column: x => x.ArticleId, - principalSchema: "blog", - principalTable: "Articles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Replies", - schema: "blog", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Client_FullName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Client_Email = table.Column(type: "nvarchar(1044)", maxLength: 1044, nullable: false), - ApproveLink_ApproveId = table.Column(type: "nvarchar(2077)", maxLength: 2077, nullable: false), - ApproveLink_ApproveExpirationOnUtc = table.Column(type: "datetime2", nullable: false), - CreatedOnUtc = table.Column(type: "datetime2", nullable: false), - Content = table.Column(type: "varchar(500)", unicode: false, maxLength: 500, nullable: false), - IsApproved = table.Column(type: "bit", nullable: false), - CommentId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Replies", x => x.Id); - table.ForeignKey( - name: "FK_Replies_Comments_CommentId", - column: x => x.CommentId, - principalSchema: "blog", - principalTable: "Comments", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "SubscriberArticleIds", - schema: "blog", - columns: table => new - { - SubscriberId = table.Column(type: "nvarchar(450)", nullable: false), - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Slug = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_SubscriberArticleIds", x => new { x.SubscriberId, x.Id }); - table.ForeignKey( - name: "FK_SubscriberArticleIds_Subscribers_SubscriberId", - column: x => x.SubscriberId, - principalSchema: "blog", - principalTable: "Subscribers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Replies_CommentId", - schema: "blog", - table: "Replies", - column: "CommentId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ArticleCommentIds", - schema: "blog"); - - migrationBuilder.DropTable( - name: "Replies", - schema: "blog"); - - migrationBuilder.DropTable( - name: "SubscriberArticleIds", - schema: "blog"); - - migrationBuilder.DropTable( - name: "Tags", - schema: "blog"); - - migrationBuilder.DropTable( - name: "Comments", - schema: "blog"); - - migrationBuilder.DropTable( - name: "Subscribers", - schema: "blog"); - - migrationBuilder.DropTable( - name: "Articles", - schema: "blog"); - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418134724_AddMaxLenForArticleAuthor.Designer.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418134724_AddMaxLenForArticleAuthor.Designer.cs deleted file mode 100644 index 38a2bcc..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418134724_AddMaxLenForArticleAuthor.Designer.cs +++ /dev/null @@ -1,385 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - [Migration("20240418134724_AddMaxLenForArticleAuthor")] - partial class AddMaxLenForArticleAuthor - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .HasColumnType("uniqueidentifier"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("SubscriberId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("SubscriberId", "Id"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418134724_AddMaxLenForArticleAuthor.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418134724_AddMaxLenForArticleAuthor.cs deleted file mode 100644 index 88ad2be..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418134724_AddMaxLenForArticleAuthor.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - /// - public partial class AddMaxLenForArticleAuthor : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Author_JobTitle", - schema: "blog", - table: "Articles", - type: "nvarchar(40)", - maxLength: 40, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Author_FullName", - schema: "blog", - table: "Articles", - type: "nvarchar(100)", - maxLength: 100, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Author_Avatar", - schema: "blog", - table: "Articles", - type: "nvarchar(1024)", - maxLength: 1024, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Author_JobTitle", - schema: "blog", - table: "Articles", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(40)", - oldMaxLength: 40); - - migrationBuilder.AlterColumn( - name: "Author_FullName", - schema: "blog", - table: "Articles", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(100)", - oldMaxLength: 100); - - migrationBuilder.AlterColumn( - name: "Author_Avatar", - schema: "blog", - table: "Articles", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(1024)", - oldMaxLength: 1024); - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135132_ChangeSubscriberIdsKey.Designer.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418135132_ChangeSubscriberIdsKey.Designer.cs deleted file mode 100644 index 4b20629..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135132_ChangeSubscriberIdsKey.Designer.cs +++ /dev/null @@ -1,381 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - [Migration("20240418135132_ChangeSubscriberIdsKey")] - partial class ChangeSubscriberIdsKey - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .HasColumnType("uniqueidentifier"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("Slug") - .HasColumnType("nvarchar(450)"); - - b1.Property("SubscriberId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b1.HasKey("Slug"); - - b1.HasIndex("SubscriberId"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135132_ChangeSubscriberIdsKey.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418135132_ChangeSubscriberIdsKey.cs deleted file mode 100644 index 9f3d0f4..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135132_ChangeSubscriberIdsKey.cs +++ /dev/null @@ -1,83 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - /// - public partial class ChangeSubscriberIdsKey : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_SubscriberArticleIds", - schema: "blog", - table: "SubscriberArticleIds"); - - migrationBuilder.DropColumn( - name: "Id", - schema: "blog", - table: "SubscriberArticleIds"); - - migrationBuilder.AlterColumn( - name: "Slug", - schema: "blog", - table: "SubscriberArticleIds", - type: "nvarchar(450)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AddPrimaryKey( - name: "PK_SubscriberArticleIds", - schema: "blog", - table: "SubscriberArticleIds", - column: "Slug"); - - migrationBuilder.CreateIndex( - name: "IX_SubscriberArticleIds_SubscriberId", - schema: "blog", - table: "SubscriberArticleIds", - column: "SubscriberId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_SubscriberArticleIds", - schema: "blog", - table: "SubscriberArticleIds"); - - migrationBuilder.DropIndex( - name: "IX_SubscriberArticleIds_SubscriberId", - schema: "blog", - table: "SubscriberArticleIds"); - - migrationBuilder.AlterColumn( - name: "Slug", - schema: "blog", - table: "SubscriberArticleIds", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(450)"); - - migrationBuilder.AddColumn( - name: "Id", - schema: "blog", - table: "SubscriberArticleIds", - type: "int", - nullable: false, - defaultValue: 0) - .Annotation("SqlServer:Identity", "1, 1"); - - migrationBuilder.AddPrimaryKey( - name: "PK_SubscriberArticleIds", - schema: "blog", - table: "SubscriberArticleIds", - columns: new[] { "SubscriberId", "Id" }); - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135333_ChangeArticleCommandIdsKey.Designer.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418135333_ChangeArticleCommandIdsKey.Designer.cs deleted file mode 100644 index 9037016..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135333_ChangeArticleCommandIdsKey.Designer.cs +++ /dev/null @@ -1,379 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - [Migration("20240418135333_ChangeArticleCommandIdsKey")] - partial class ChangeArticleCommandIdsKey - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("Value") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b1.Property("ArticleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b1.HasKey("Value"); - - b1.HasIndex("ArticleId"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("Slug") - .HasColumnType("nvarchar(450)"); - - b1.Property("SubscriberId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b1.HasKey("Slug"); - - b1.HasIndex("SubscriberId"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135333_ChangeArticleCommandIdsKey.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418135333_ChangeArticleCommandIdsKey.cs deleted file mode 100644 index c3daf47..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135333_ChangeArticleCommandIdsKey.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - /// - public partial class ChangeArticleCommandIdsKey : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_ArticleCommentIds", - schema: "blog", - table: "ArticleCommentIds"); - - migrationBuilder.DropColumn( - name: "Id", - schema: "blog", - table: "ArticleCommentIds"); - - migrationBuilder.AddPrimaryKey( - name: "PK_ArticleCommentIds", - schema: "blog", - table: "ArticleCommentIds", - column: "Value"); - - migrationBuilder.CreateIndex( - name: "IX_ArticleCommentIds_ArticleId", - schema: "blog", - table: "ArticleCommentIds", - column: "ArticleId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_ArticleCommentIds", - schema: "blog", - table: "ArticleCommentIds"); - - migrationBuilder.DropIndex( - name: "IX_ArticleCommentIds_ArticleId", - schema: "blog", - table: "ArticleCommentIds"); - - migrationBuilder.AddColumn( - name: "Id", - schema: "blog", - table: "ArticleCommentIds", - type: "int", - nullable: false, - defaultValue: 0) - .Annotation("SqlServer:Identity", "1, 1"); - - migrationBuilder.AddPrimaryKey( - name: "PK_ArticleCommentIds", - schema: "blog", - table: "ArticleCommentIds", - columns: new[] { "ArticleId", "Id" }); - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135617_ChangeForeignKeysName.Designer.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418135617_ChangeForeignKeysName.Designer.cs deleted file mode 100644 index 7439668..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135617_ChangeForeignKeysName.Designer.cs +++ /dev/null @@ -1,381 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - [Migration("20240418135617_ChangeForeignKeysName")] - partial class ChangeForeignKeysName - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("Value") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasColumnName("CommentId"); - - b1.Property("ArticleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b1.HasKey("Value"); - - b1.HasIndex("ArticleId"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("Slug") - .HasColumnType("nvarchar(450)") - .HasColumnName("ArticleId"); - - b1.Property("SubscriberId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b1.HasKey("Slug"); - - b1.HasIndex("SubscriberId"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135617_ChangeForeignKeysName.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418135617_ChangeForeignKeysName.cs deleted file mode 100644 index 189cef2..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135617_ChangeForeignKeysName.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - /// - public partial class ChangeForeignKeysName : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Slug", - schema: "blog", - table: "SubscriberArticleIds", - newName: "ArticleId"); - - migrationBuilder.RenameColumn( - name: "Value", - schema: "blog", - table: "ArticleCommentIds", - newName: "CommentId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ArticleId", - schema: "blog", - table: "SubscriberArticleIds", - newName: "Slug"); - - migrationBuilder.RenameColumn( - name: "CommentId", - schema: "blog", - table: "ArticleCommentIds", - newName: "Value"); - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135859_ChangeForeignKeArticle.Designer.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418135859_ChangeForeignKeArticle.Designer.cs deleted file mode 100644 index bd67ded..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135859_ChangeForeignKeArticle.Designer.cs +++ /dev/null @@ -1,385 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - [Migration("20240418135859_ChangeForeignKeArticle")] - partial class ChangeForeignKeArticle - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("Value") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasColumnName("CommentId"); - - b1.Property("ArticleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b1.HasKey("Value"); - - b1.HasIndex("ArticleId"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("SubscriberId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("SubscriberId", "Id"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135859_ChangeForeignKeArticle.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418135859_ChangeForeignKeArticle.cs deleted file mode 100644 index 4596c72..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418135859_ChangeForeignKeArticle.cs +++ /dev/null @@ -1,83 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - /// - public partial class ChangeForeignKeArticle : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_SubscriberArticleIds", - schema: "blog", - table: "SubscriberArticleIds"); - - migrationBuilder.DropIndex( - name: "IX_SubscriberArticleIds_SubscriberId", - schema: "blog", - table: "SubscriberArticleIds"); - - migrationBuilder.AlterColumn( - name: "ArticleId", - schema: "blog", - table: "SubscriberArticleIds", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(450)"); - - migrationBuilder.AddColumn( - name: "Id", - schema: "blog", - table: "SubscriberArticleIds", - type: "int", - nullable: false, - defaultValue: 0) - .Annotation("SqlServer:Identity", "1, 1"); - - migrationBuilder.AddPrimaryKey( - name: "PK_SubscriberArticleIds", - schema: "blog", - table: "SubscriberArticleIds", - columns: new[] { "SubscriberId", "Id" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_SubscriberArticleIds", - schema: "blog", - table: "SubscriberArticleIds"); - - migrationBuilder.DropColumn( - name: "Id", - schema: "blog", - table: "SubscriberArticleIds"); - - migrationBuilder.AlterColumn( - name: "ArticleId", - schema: "blog", - table: "SubscriberArticleIds", - type: "nvarchar(450)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AddPrimaryKey( - name: "PK_SubscriberArticleIds", - schema: "blog", - table: "SubscriberArticleIds", - column: "ArticleId"); - - migrationBuilder.CreateIndex( - name: "IX_SubscriberArticleIds_SubscriberId", - schema: "blog", - table: "SubscriberArticleIds", - column: "SubscriberId"); - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418140031_ChangeForeignKeArticleComment.Designer.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418140031_ChangeForeignKeArticleComment.Designer.cs deleted file mode 100644 index 5abb07a..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418140031_ChangeForeignKeArticleComment.Designer.cs +++ /dev/null @@ -1,387 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - [Migration("20240418140031_ChangeForeignKeArticleComment")] - partial class ChangeForeignKeArticleComment - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .HasColumnType("uniqueidentifier") - .HasColumnName("CommentId"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("SubscriberId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("SubscriberId", "Id"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240418140031_ChangeForeignKeArticleComment.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240418140031_ChangeForeignKeArticleComment.cs deleted file mode 100644 index ad3eb87..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240418140031_ChangeForeignKeArticleComment.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - /// - public partial class ChangeForeignKeArticleComment : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_ArticleCommentIds", - schema: "blog", - table: "ArticleCommentIds"); - - migrationBuilder.DropIndex( - name: "IX_ArticleCommentIds_ArticleId", - schema: "blog", - table: "ArticleCommentIds"); - - migrationBuilder.AddColumn( - name: "Id", - schema: "blog", - table: "ArticleCommentIds", - type: "int", - nullable: false, - defaultValue: 0) - .Annotation("SqlServer:Identity", "1, 1"); - - migrationBuilder.AddPrimaryKey( - name: "PK_ArticleCommentIds", - schema: "blog", - table: "ArticleCommentIds", - columns: new[] { "ArticleId", "Id" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_ArticleCommentIds", - schema: "blog", - table: "ArticleCommentIds"); - - migrationBuilder.DropColumn( - name: "Id", - schema: "blog", - table: "ArticleCommentIds"); - - migrationBuilder.AddPrimaryKey( - name: "PK_ArticleCommentIds", - schema: "blog", - table: "ArticleCommentIds", - column: "CommentId"); - - migrationBuilder.CreateIndex( - name: "IX_ArticleCommentIds_ArticleId", - schema: "blog", - table: "ArticleCommentIds", - column: "ArticleId"); - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240419173133_ChangePublidhedToNullable.Designer.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240419173133_ChangePublidhedToNullable.Designer.cs deleted file mode 100644 index fdac3ca..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240419173133_ChangePublidhedToNullable.Designer.cs +++ /dev/null @@ -1,387 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - [Migration("20240419173133_ChangePublidhedToNullable")] - partial class ChangePublidhedToNullable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .HasColumnType("uniqueidentifier") - .HasColumnName("CommentId"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("SubscriberId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("SubscriberId", "Id"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/20240419173133_ChangePublidhedToNullable.cs b/src/Blogger.Infrastructure/Persistence/Migrations/20240419173133_ChangePublidhedToNullable.cs deleted file mode 100644 index 42a3ef8..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/20240419173133_ChangePublidhedToNullable.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - /// - public partial class ChangePublidhedToNullable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "PublishedOnUtc", - schema: "blog", - table: "Articles", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "datetime2", - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "PublishedOnUtc", - schema: "blog", - table: "Articles", - type: "datetime2", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "datetime2"); - } - } -} diff --git a/src/Blogger.Infrastructure/Persistence/Migrations/BloggerDbContextModelSnapshot.cs b/src/Blogger.Infrastructure/Persistence/Migrations/BloggerDbContextModelSnapshot.cs deleted file mode 100644 index f98d670..0000000 --- a/src/Blogger.Infrastructure/Persistence/Migrations/BloggerDbContextModelSnapshot.cs +++ /dev/null @@ -1,384 +0,0 @@ -// -using System; -using Blogger.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Blogger.Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(BloggerDbContext))] - partial class BloggerDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("blog") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .IsUnicode(true) - .HasColumnType("nvarchar(max)"); - - b.Property("PublishedOnUtc") - .HasColumnType("datetime2"); - - b.Property("ReadOn") - .HasColumnType("time"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(300) - .IsUnicode(false) - .HasColumnType("varchar(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(70) - .IsUnicode(false) - .HasColumnType("varchar(70)"); - - b.HasKey("Id"); - - b.ToTable("Articles", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b.Property("IsApproved") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("Comments", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("JoinedOnUtc") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.ToTable("Subscribers", "blog"); - }); - - modelBuilder.Entity("Blogger.Domain.ArticleAggregate.Article", b => - { - b.OwnsOne("Blogger.Domain.ArticleAggregate.Author", "Author", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Avatar") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("nvarchar(1024)") - .HasColumnName("Author_Avatar"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)") - .HasColumnName("Author_FullName"); - - b1.Property("JobTitle") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("Author_JobTitle"); - - b1.HasKey("ArticleId"); - - b1.ToTable("Articles", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.ArticleAggregate.Tag", "Tags", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("Tags", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.CommentId", "CommnetIds", b1 => - { - b1.Property("ArticleId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Value") - .HasColumnType("uniqueidentifier") - .HasColumnName("CommentId"); - - b1.HasKey("ArticleId", "Id"); - - b1.ToTable("ArticleCommentIds", "blog"); - - b1.WithOwner() - .HasForeignKey("ArticleId"); - }); - - b.Navigation("Author") - .IsRequired(); - - b.Navigation("CommnetIds"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Blogger.Domain.CommentAggregate.Comment", b => - { - b.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b1.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleId", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b1 => - { - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b1.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b1.HasKey("CommentId"); - - b1.ToTable("Comments", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - }); - - b.OwnsMany("Blogger.Domain.CommentAggregate.Reply", "Replies", b1 => - { - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("CommentId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Content") - .IsRequired() - .HasMaxLength(500) - .IsUnicode(false) - .HasColumnType("varchar(500)"); - - b1.Property("CreatedOnUtc") - .HasColumnType("datetime2"); - - b1.Property("IsApproved") - .HasColumnType("bit"); - - b1.HasKey("Id"); - - b1.HasIndex("CommentId"); - - b1.ToTable("Replies", "blog"); - - b1.WithOwner() - .HasForeignKey("CommentId"); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.ApproveLink", "ApproveLink", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("ApproveId") - .IsRequired() - .HasMaxLength(2077) - .HasColumnType("nvarchar(2077)") - .HasColumnName("ApproveLink_ApproveId"); - - b2.Property("ExpirationOnUtc") - .HasColumnType("datetime2") - .HasColumnName("ApproveLink_ApproveExpirationOnUtc"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.OwnsOne("Blogger.Domain.CommentAggregate.Client", "Client", b2 => - { - b2.Property("ReplyId") - .HasColumnType("uniqueidentifier"); - - b2.Property("Email") - .IsRequired() - .HasMaxLength(1044) - .IsUnicode(true) - .HasColumnType("nvarchar(1044)") - .HasColumnName("Client_Email"); - - b2.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(true) - .HasColumnType("nvarchar(100)") - .HasColumnName("Client_FullName"); - - b2.HasKey("ReplyId"); - - b2.ToTable("Replies", "blog"); - - b2.WithOwner() - .HasForeignKey("ReplyId"); - }); - - b1.Navigation("ApproveLink") - .IsRequired(); - - b1.Navigation("Client") - .IsRequired(); - }); - - b.Navigation("ApproveLink") - .IsRequired(); - - b.Navigation("ArticleId") - .IsRequired(); - - b.Navigation("Client") - .IsRequired(); - - b.Navigation("Replies"); - }); - - modelBuilder.Entity("Blogger.Domain.SubscriberAggregate.Subscriber", b => - { - b.OwnsMany("Blogger.Domain.ArticleAggregate.ArticleId", "ArticleIds", b1 => - { - b1.Property("SubscriberId") - .HasColumnType("nvarchar(450)"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); - - b1.Property("Slug") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasColumnName("ArticleId"); - - b1.HasKey("SubscriberId", "Id"); - - b1.ToTable("SubscriberArticleIds", "blog"); - - b1.WithOwner() - .HasForeignKey("SubscriberId"); - }); - - b.Navigation("ArticleIds"); - }); -#pragma warning restore 612, 618 - } - } -}