From 0f3f786a3125fb6252d06320b39f75fe3a4da63a Mon Sep 17 00:00:00 2001 From: Paul Csiki Date: Thu, 23 May 2024 21:35:59 +0100 Subject: [PATCH] Fix migrations for MySQL --- src/Domain/Entities/Folder.cs | 1 + src/Infrastructure/Infrastructure.csproj | 9 +- .../20230902062047_InitProd.Designer.cs | 453 ----------- .../Migrations/20230902062047_InitProd.cs | 315 -------- ...20230911113759_AddedHighlights.Designer.cs | 533 ------------- .../20230911113759_AddedHighlights.cs | 74 -- ...11141116_FixHighlightReference.Designer.cs | 532 ------------- .../20230911141116_FixHighlightReference.cs | 85 -- ...134330_AddedAiExplanationCount.Designer.cs | 534 ------------- .../20231013134330_AddedAiExplanationCount.cs | 26 - .../20231017161702_AddBookmarks.Designer.cs | 572 -------------- .../Migrations/20231017161702_AddBookmarks.cs | 45 -- ...060059_AddedProjectGutenbergId.Designer.cs | 575 -------------- .../20231018060059_AddedProjectGutenbergId.cs | 26 - .../Migrations/DataContextModelSnapshot.cs | 732 ------------------ 15 files changed, 6 insertions(+), 4506 deletions(-) delete mode 100644 src/Infrastructure/Persistence/Migrations/20230902062047_InitProd.Designer.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20230902062047_InitProd.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20230911113759_AddedHighlights.Designer.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20230911113759_AddedHighlights.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20230911141116_FixHighlightReference.Designer.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20230911141116_FixHighlightReference.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20231013134330_AddedAiExplanationCount.Designer.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20231013134330_AddedAiExplanationCount.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20231017161702_AddBookmarks.Designer.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20231017161702_AddBookmarks.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20231018060059_AddedProjectGutenbergId.Designer.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/20231018060059_AddedProjectGutenbergId.cs delete mode 100644 src/Infrastructure/Persistence/Migrations/DataContextModelSnapshot.cs diff --git a/src/Domain/Entities/Folder.cs b/src/Domain/Entities/Folder.cs index 5af3955..596646e 100644 --- a/src/Domain/Entities/Folder.cs +++ b/src/Domain/Entities/Folder.cs @@ -23,6 +23,7 @@ public class Folder public string Icon { get; set; } [MaxLength(10000, ErrorMessage = "The description is too long")] + [Column(TypeName = "text")] public string Description { get; set; } [Required] diff --git a/src/Infrastructure/Infrastructure.csproj b/src/Infrastructure/Infrastructure.csproj index 5aaa156..eac079a 100644 --- a/src/Infrastructure/Infrastructure.csproj +++ b/src/Infrastructure/Infrastructure.csproj @@ -10,6 +10,11 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + @@ -17,8 +22,4 @@ - - - - diff --git a/src/Infrastructure/Persistence/Migrations/20230902062047_InitProd.Designer.cs b/src/Infrastructure/Persistence/Migrations/20230902062047_InitProd.Designer.cs deleted file mode 100644 index b1e8760..0000000 --- a/src/Infrastructure/Persistence/Migrations/20230902062047_InitProd.Designer.cs +++ /dev/null @@ -1,453 +0,0 @@ -// -using System; -using 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 Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20230902062047_InitProd")] - partial class InitProd - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("AddedToLibrary") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Authors") - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("CoverLastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CoverSize") - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("Creator") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("CurrentPage") - .HasColumnType("int"); - - b.Property("DocumentSize") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Format") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasCover") - .HasColumnType("bit"); - - b.Property("Language") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastOpened") - .HasColumnType("nvarchar(max)"); - - b.Property("PageCount") - .HasColumnType("int"); - - b.Property("PagesSize") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Books"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationDate") - .HasColumnType("datetime2"); - - b.Property("Name") - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("TagId"); - - b.HasIndex("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("AccountCreation") - .HasColumnType("datetime2"); - - b.Property("BookStorageLimit") - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasProfilePicture") - .HasColumnType("bit"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("ProfilePictureLastUpdated") - .HasColumnType("datetime2"); - - b.Property("Role") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.HasOne("Domain.Entities.User", "User") - .WithMany("Books") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.HasOne("Domain.Entities.Book", null) - .WithMany("Tags") - .HasForeignKey("BookId"); - - b.HasOne("Domain.Entities.User", "User") - .WithMany("Tags") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Navigation("Books"); - - b.Navigation("Tags"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20230902062047_InitProd.cs b/src/Infrastructure/Persistence/Migrations/20230902062047_InitProd.cs deleted file mode 100644 index d344d4b..0000000 --- a/src/Infrastructure/Persistence/Migrations/20230902062047_InitProd.cs +++ /dev/null @@ -1,315 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infrastructure.Persistence.Migrations -{ - public partial class InitProd : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - FirstName = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - LastName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), - Role = table.Column(type: "nvarchar(max)", nullable: false), - AccountCreation = table.Column(type: "datetime2", nullable: false), - ProfilePictureLastUpdated = table.Column(type: "datetime2", nullable: false), - HasProfilePicture = table.Column(type: "bit", nullable: false), - BookStorageLimit = table.Column(type: "bigint", nullable: false), - UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "bit", nullable: false), - PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), - SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), - TwoFactorEnabled = table.Column(type: "bit", nullable: false), - LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), - LockoutEnabled = table.Column(type: "bit", nullable: false), - AccessFailedCount = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - RoleId = table.Column(type: "nvarchar(450)", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UserId = table.Column(type: "nvarchar(450)", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), - ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), - UserId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", nullable: false), - RoleId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", nullable: false), - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(450)", nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Books", - columns: table => new - { - BookId = table.Column(type: "uniqueidentifier", nullable: false), - Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - PageCount = table.Column(type: "int", nullable: false), - CurrentPage = table.Column(type: "int", nullable: false), - Format = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - Language = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - DocumentSize = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - PagesSize = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Creator = table.Column(type: "nvarchar(140)", maxLength: 140, nullable: true), - Authors = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: true), - CreationDate = table.Column(type: "nvarchar(140)", maxLength: 140, nullable: true), - AddedToLibrary = table.Column(type: "nvarchar(max)", nullable: false), - LastOpened = table.Column(type: "nvarchar(max)", nullable: true), - LastModified = table.Column(type: "nvarchar(max)", nullable: false), - CoverLastModified = table.Column(type: "nvarchar(max)", nullable: false), - CoverSize = table.Column(type: "bigint", nullable: false), - HasCover = table.Column(type: "bit", nullable: false), - UserId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Books", x => x.BookId); - table.ForeignKey( - name: "FK_Books_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Tags", - columns: table => new - { - TagId = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: true), - CreationDate = table.Column(type: "datetime2", nullable: false), - UserId = table.Column(type: "nvarchar(450)", nullable: false), - BookId = table.Column(type: "uniqueidentifier", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Tags", x => x.TagId); - table.ForeignKey( - name: "FK_Tags_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Tags_Books_BookId", - column: x => x.BookId, - principalTable: "Books", - principalColumn: "BookId"); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true, - filter: "[NormalizedName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUsers_Email", - table: "AspNetUsers", - column: "Email", - unique: true); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true, - filter: "[NormalizedUserName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_Books_UserId", - table: "Books", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Tags_BookId", - table: "Tags", - column: "BookId"); - - migrationBuilder.CreateIndex( - name: "IX_Tags_UserId", - table: "Tags", - column: "UserId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "Tags"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropTable( - name: "Books"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20230911113759_AddedHighlights.Designer.cs b/src/Infrastructure/Persistence/Migrations/20230911113759_AddedHighlights.Designer.cs deleted file mode 100644 index e160db8..0000000 --- a/src/Infrastructure/Persistence/Migrations/20230911113759_AddedHighlights.Designer.cs +++ /dev/null @@ -1,533 +0,0 @@ -// -using System; -using 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 Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20230911113759_AddedHighlights")] - partial class AddedHighlights - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("AddedToLibrary") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Authors") - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("CoverLastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CoverSize") - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("Creator") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("CurrentPage") - .HasColumnType("int"); - - b.Property("DocumentSize") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Format") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasCover") - .HasColumnType("bit"); - - b.Property("Language") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastOpened") - .HasColumnType("nvarchar(max)"); - - b.Property("PageCount") - .HasColumnType("int"); - - b.Property("PagesSize") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Books"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("nvarchar(max)"); - - b.Property("BookId1") - .HasColumnType("uniqueidentifier"); - - b.Property("Color") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.HasKey("HighlightId"); - - b.HasIndex("BookId1"); - - b.ToTable("Highlights"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.Property("RectFId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Height") - .HasColumnType("real"); - - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("Width") - .HasColumnType("real"); - - b.Property("X") - .HasColumnType("real"); - - b.Property("Y") - .HasColumnType("real"); - - b.HasKey("RectFId"); - - b.HasIndex("HighlightId"); - - b.ToTable("RectF"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationDate") - .HasColumnType("datetime2"); - - b.Property("Name") - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("TagId"); - - b.HasIndex("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("AccountCreation") - .HasColumnType("datetime2"); - - b.Property("BookStorageLimit") - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasProfilePicture") - .HasColumnType("bit"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("ProfilePictureLastUpdated") - .HasColumnType("datetime2"); - - b.Property("Role") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.HasOne("Domain.Entities.User", "User") - .WithMany("Books") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Highlights") - .HasForeignKey("BookId1"); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.HasOne("Domain.Entities.Highlight", "Highlight") - .WithMany("Rects") - .HasForeignKey("HighlightId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Highlight"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.HasOne("Domain.Entities.Book", null) - .WithMany("Tags") - .HasForeignKey("BookId"); - - b.HasOne("Domain.Entities.User", "User") - .WithMany("Tags") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Navigation("Highlights"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Navigation("Rects"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Navigation("Books"); - - b.Navigation("Tags"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20230911113759_AddedHighlights.cs b/src/Infrastructure/Persistence/Migrations/20230911113759_AddedHighlights.cs deleted file mode 100644 index 8dbf656..0000000 --- a/src/Infrastructure/Persistence/Migrations/20230911113759_AddedHighlights.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infrastructure.Persistence.Migrations -{ - public partial class AddedHighlights : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Highlights", - columns: table => new - { - HighlightId = table.Column(type: "uniqueidentifier", nullable: false), - Color = table.Column(type: "nvarchar(max)", nullable: false), - PageNumber = table.Column(type: "int", nullable: false), - BookId = table.Column(type: "nvarchar(max)", nullable: true), - BookId1 = table.Column(type: "uniqueidentifier", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Highlights", x => x.HighlightId); - table.ForeignKey( - name: "FK_Highlights_Books_BookId1", - column: x => x.BookId1, - principalTable: "Books", - principalColumn: "BookId"); - }); - - migrationBuilder.CreateTable( - name: "RectF", - columns: table => new - { - RectFId = table.Column(type: "uniqueidentifier", nullable: false), - X = table.Column(type: "real", nullable: false), - Y = table.Column(type: "real", nullable: false), - Width = table.Column(type: "real", nullable: false), - Height = table.Column(type: "real", nullable: false), - HighlightId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_RectF", x => x.RectFId); - table.ForeignKey( - name: "FK_RectF_Highlights_HighlightId", - column: x => x.HighlightId, - principalTable: "Highlights", - principalColumn: "HighlightId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Highlights_BookId1", - table: "Highlights", - column: "BookId1"); - - migrationBuilder.CreateIndex( - name: "IX_RectF_HighlightId", - table: "RectF", - column: "HighlightId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "RectF"); - - migrationBuilder.DropTable( - name: "Highlights"); - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20230911141116_FixHighlightReference.Designer.cs b/src/Infrastructure/Persistence/Migrations/20230911141116_FixHighlightReference.Designer.cs deleted file mode 100644 index 72ec545..0000000 --- a/src/Infrastructure/Persistence/Migrations/20230911141116_FixHighlightReference.Designer.cs +++ /dev/null @@ -1,532 +0,0 @@ -// -using System; -using 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 Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20230911141116_FixHighlightReference")] - partial class FixHighlightReference - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("AddedToLibrary") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Authors") - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("CoverLastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CoverSize") - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("Creator") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("CurrentPage") - .HasColumnType("int"); - - b.Property("DocumentSize") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Format") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasCover") - .HasColumnType("bit"); - - b.Property("Language") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastOpened") - .HasColumnType("nvarchar(max)"); - - b.Property("PageCount") - .HasColumnType("int"); - - b.Property("PagesSize") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Books"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("Color") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.HasKey("HighlightId"); - - b.HasIndex("BookId"); - - b.ToTable("Highlights"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.Property("RectFId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Height") - .HasColumnType("real"); - - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("Width") - .HasColumnType("real"); - - b.Property("X") - .HasColumnType("real"); - - b.Property("Y") - .HasColumnType("real"); - - b.HasKey("RectFId"); - - b.HasIndex("HighlightId"); - - b.ToTable("RectF"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationDate") - .HasColumnType("datetime2"); - - b.Property("Name") - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("TagId"); - - b.HasIndex("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("AccountCreation") - .HasColumnType("datetime2"); - - b.Property("BookStorageLimit") - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasProfilePicture") - .HasColumnType("bit"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("ProfilePictureLastUpdated") - .HasColumnType("datetime2"); - - b.Property("Role") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.HasOne("Domain.Entities.User", "User") - .WithMany("Books") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Highlights") - .HasForeignKey("BookId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.HasOne("Domain.Entities.Highlight", "Highlight") - .WithMany("Rects") - .HasForeignKey("HighlightId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Highlight"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.HasOne("Domain.Entities.Book", null) - .WithMany("Tags") - .HasForeignKey("BookId"); - - b.HasOne("Domain.Entities.User", "User") - .WithMany("Tags") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Navigation("Highlights"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Navigation("Rects"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Navigation("Books"); - - b.Navigation("Tags"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20230911141116_FixHighlightReference.cs b/src/Infrastructure/Persistence/Migrations/20230911141116_FixHighlightReference.cs deleted file mode 100644 index eb5f95c..0000000 --- a/src/Infrastructure/Persistence/Migrations/20230911141116_FixHighlightReference.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infrastructure.Persistence.Migrations -{ - public partial class FixHighlightReference : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Highlights_Books_BookId1", - table: "Highlights"); - - migrationBuilder.DropIndex( - name: "IX_Highlights_BookId1", - table: "Highlights"); - - migrationBuilder.DropColumn( - name: "BookId1", - table: "Highlights"); - - migrationBuilder.AlterColumn( - name: "BookId", - table: "Highlights", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Highlights_BookId", - table: "Highlights", - column: "BookId"); - - migrationBuilder.AddForeignKey( - name: "FK_Highlights_Books_BookId", - table: "Highlights", - column: "BookId", - principalTable: "Books", - principalColumn: "BookId", - onDelete: ReferentialAction.Cascade); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Highlights_Books_BookId", - table: "Highlights"); - - migrationBuilder.DropIndex( - name: "IX_Highlights_BookId", - table: "Highlights"); - - migrationBuilder.AlterColumn( - name: "BookId", - table: "Highlights", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - - migrationBuilder.AddColumn( - name: "BookId1", - table: "Highlights", - type: "uniqueidentifier", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Highlights_BookId1", - table: "Highlights", - column: "BookId1"); - - migrationBuilder.AddForeignKey( - name: "FK_Highlights_Books_BookId1", - table: "Highlights", - column: "BookId1", - principalTable: "Books", - principalColumn: "BookId"); - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20231013134330_AddedAiExplanationCount.Designer.cs b/src/Infrastructure/Persistence/Migrations/20231013134330_AddedAiExplanationCount.Designer.cs deleted file mode 100644 index 6b12814..0000000 --- a/src/Infrastructure/Persistence/Migrations/20231013134330_AddedAiExplanationCount.Designer.cs +++ /dev/null @@ -1,534 +0,0 @@ -// -using System; -using 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 Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20231013134330_AddedAiExplanationCount")] - partial class AddedAiExplanationCount - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("AddedToLibrary") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Authors") - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("CoverLastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CoverSize") - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("Creator") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("CurrentPage") - .HasColumnType("int"); - - b.Property("DocumentSize") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Format") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasCover") - .HasColumnType("bit"); - - b.Property("Language") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastOpened") - .HasColumnType("nvarchar(max)"); - - b.Property("PageCount") - .HasColumnType("int"); - - b.Property("PagesSize") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Books"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("Color") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.HasKey("HighlightId"); - - b.HasIndex("BookId"); - - b.ToTable("Highlights"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.Property("RectFId") - .HasColumnType("uniqueidentifier"); - - b.Property("Height") - .HasColumnType("real"); - - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("Width") - .HasColumnType("real"); - - b.Property("X") - .HasColumnType("real"); - - b.Property("Y") - .HasColumnType("real"); - - b.HasKey("RectFId"); - - b.HasIndex("HighlightId"); - - b.ToTable("RectF"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationDate") - .HasColumnType("datetime2"); - - b.Property("Name") - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("TagId"); - - b.HasIndex("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("AccountCreation") - .HasColumnType("datetime2"); - - b.Property("AiExplanationRequestsMadeToday") - .HasColumnType("int"); - - b.Property("BookStorageLimit") - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasProfilePicture") - .HasColumnType("bit"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("ProfilePictureLastUpdated") - .HasColumnType("datetime2"); - - b.Property("Role") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.HasOne("Domain.Entities.User", "User") - .WithMany("Books") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Highlights") - .HasForeignKey("BookId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.HasOne("Domain.Entities.Highlight", "Highlight") - .WithMany("Rects") - .HasForeignKey("HighlightId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Highlight"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.HasOne("Domain.Entities.Book", null) - .WithMany("Tags") - .HasForeignKey("BookId"); - - b.HasOne("Domain.Entities.User", "User") - .WithMany("Tags") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Navigation("Highlights"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Navigation("Rects"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Navigation("Books"); - - b.Navigation("Tags"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20231013134330_AddedAiExplanationCount.cs b/src/Infrastructure/Persistence/Migrations/20231013134330_AddedAiExplanationCount.cs deleted file mode 100644 index 91cc6fb..0000000 --- a/src/Infrastructure/Persistence/Migrations/20231013134330_AddedAiExplanationCount.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infrastructure.Persistence.Migrations -{ - public partial class AddedAiExplanationCount : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AiExplanationRequestsMadeToday", - table: "AspNetUsers", - type: "int", - nullable: false, - defaultValue: 0); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AiExplanationRequestsMadeToday", - table: "AspNetUsers"); - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20231017161702_AddBookmarks.Designer.cs b/src/Infrastructure/Persistence/Migrations/20231017161702_AddBookmarks.Designer.cs deleted file mode 100644 index 0e58130..0000000 --- a/src/Infrastructure/Persistence/Migrations/20231017161702_AddBookmarks.Designer.cs +++ /dev/null @@ -1,572 +0,0 @@ -// -using System; -using 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 Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20231017161702_AddBookmarks")] - partial class AddBookmarks - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("AddedToLibrary") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Authors") - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("CoverLastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CoverSize") - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("Creator") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("CurrentPage") - .HasColumnType("int"); - - b.Property("DocumentSize") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Format") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasCover") - .HasColumnType("bit"); - - b.Property("Language") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastOpened") - .HasColumnType("nvarchar(max)"); - - b.Property("PageCount") - .HasColumnType("int"); - - b.Property("PagesSize") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Books"); - }); - - modelBuilder.Entity("Domain.Entities.Bookmark", b => - { - b.Property("BookmarkId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.Property("YOffset") - .HasColumnType("real"); - - b.HasKey("BookmarkId"); - - b.HasIndex("BookId"); - - b.ToTable("Bookmarks"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("Color") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.HasKey("HighlightId"); - - b.HasIndex("BookId"); - - b.ToTable("Highlights"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.Property("RectFId") - .HasColumnType("uniqueidentifier"); - - b.Property("Height") - .HasColumnType("real"); - - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("Width") - .HasColumnType("real"); - - b.Property("X") - .HasColumnType("real"); - - b.Property("Y") - .HasColumnType("real"); - - b.HasKey("RectFId"); - - b.HasIndex("HighlightId"); - - b.ToTable("RectF"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationDate") - .HasColumnType("datetime2"); - - b.Property("Name") - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("TagId"); - - b.HasIndex("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("AccountCreation") - .HasColumnType("datetime2"); - - b.Property("AiExplanationRequestsMadeToday") - .HasColumnType("int"); - - b.Property("BookStorageLimit") - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasProfilePicture") - .HasColumnType("bit"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("ProfilePictureLastUpdated") - .HasColumnType("datetime2"); - - b.Property("Role") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.HasOne("Domain.Entities.User", "User") - .WithMany("Books") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Domain.Entities.Bookmark", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Bookmarks") - .HasForeignKey("BookId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Highlights") - .HasForeignKey("BookId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.HasOne("Domain.Entities.Highlight", "Highlight") - .WithMany("Rects") - .HasForeignKey("HighlightId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Highlight"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.HasOne("Domain.Entities.Book", null) - .WithMany("Tags") - .HasForeignKey("BookId"); - - b.HasOne("Domain.Entities.User", "User") - .WithMany("Tags") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Navigation("Bookmarks"); - - b.Navigation("Highlights"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Navigation("Rects"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Navigation("Books"); - - b.Navigation("Tags"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20231017161702_AddBookmarks.cs b/src/Infrastructure/Persistence/Migrations/20231017161702_AddBookmarks.cs deleted file mode 100644 index e143c7d..0000000 --- a/src/Infrastructure/Persistence/Migrations/20231017161702_AddBookmarks.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infrastructure.Persistence.Migrations -{ - public partial class AddBookmarks : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Bookmarks", - columns: table => new - { - BookmarkId = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - PageNumber = table.Column(type: "int", nullable: false), - YOffset = table.Column(type: "real", nullable: false), - BookId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Bookmarks", x => x.BookmarkId); - table.ForeignKey( - name: "FK_Bookmarks_Books_BookId", - column: x => x.BookId, - principalTable: "Books", - principalColumn: "BookId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Bookmarks_BookId", - table: "Bookmarks", - column: "BookId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Bookmarks"); - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20231018060059_AddedProjectGutenbergId.Designer.cs b/src/Infrastructure/Persistence/Migrations/20231018060059_AddedProjectGutenbergId.Designer.cs deleted file mode 100644 index 6a0fd7b..0000000 --- a/src/Infrastructure/Persistence/Migrations/20231018060059_AddedProjectGutenbergId.Designer.cs +++ /dev/null @@ -1,575 +0,0 @@ -// -using System; -using 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 Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20231018060059_AddedProjectGutenbergId")] - partial class AddedProjectGutenbergId - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("AddedToLibrary") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Authors") - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("CoverLastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CoverSize") - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("Creator") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("CurrentPage") - .HasColumnType("int"); - - b.Property("DocumentSize") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Format") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasCover") - .HasColumnType("bit"); - - b.Property("Language") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastOpened") - .HasColumnType("nvarchar(max)"); - - b.Property("PageCount") - .HasColumnType("int"); - - b.Property("PagesSize") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ProjectGutenbergId") - .HasColumnType("int"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Books"); - }); - - modelBuilder.Entity("Domain.Entities.Bookmark", b => - { - b.Property("BookmarkId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.Property("YOffset") - .HasColumnType("real"); - - b.HasKey("BookmarkId"); - - b.HasIndex("BookId"); - - b.ToTable("Bookmarks"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("Color") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.HasKey("HighlightId"); - - b.HasIndex("BookId"); - - b.ToTable("Highlights"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.Property("RectFId") - .HasColumnType("uniqueidentifier"); - - b.Property("Height") - .HasColumnType("real"); - - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("Width") - .HasColumnType("real"); - - b.Property("X") - .HasColumnType("real"); - - b.Property("Y") - .HasColumnType("real"); - - b.HasKey("RectFId"); - - b.HasIndex("HighlightId"); - - b.ToTable("RectF"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationDate") - .HasColumnType("datetime2"); - - b.Property("Name") - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("TagId"); - - b.HasIndex("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("AccountCreation") - .HasColumnType("datetime2"); - - b.Property("AiExplanationRequestsMadeToday") - .HasColumnType("int"); - - b.Property("BookStorageLimit") - .HasColumnType("bigint"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasProfilePicture") - .HasColumnType("bit"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("ProfilePictureLastUpdated") - .HasColumnType("datetime2"); - - b.Property("Role") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.HasOne("Domain.Entities.User", "User") - .WithMany("Books") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Domain.Entities.Bookmark", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Bookmarks") - .HasForeignKey("BookId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Highlights") - .HasForeignKey("BookId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.HasOne("Domain.Entities.Highlight", "Highlight") - .WithMany("Rects") - .HasForeignKey("HighlightId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Highlight"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.HasOne("Domain.Entities.Book", null) - .WithMany("Tags") - .HasForeignKey("BookId"); - - b.HasOne("Domain.Entities.User", "User") - .WithMany("Tags") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Navigation("Bookmarks"); - - b.Navigation("Highlights"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Navigation("Rects"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Navigation("Books"); - - b.Navigation("Tags"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/20231018060059_AddedProjectGutenbergId.cs b/src/Infrastructure/Persistence/Migrations/20231018060059_AddedProjectGutenbergId.cs deleted file mode 100644 index 9de7763..0000000 --- a/src/Infrastructure/Persistence/Migrations/20231018060059_AddedProjectGutenbergId.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infrastructure.Persistence.Migrations -{ - public partial class AddedProjectGutenbergId : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ProjectGutenbergId", - table: "Books", - type: "int", - nullable: false, - defaultValue: 0); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProjectGutenbergId", - table: "Books"); - } - } -} diff --git a/src/Infrastructure/Persistence/Migrations/DataContextModelSnapshot.cs b/src/Infrastructure/Persistence/Migrations/DataContextModelSnapshot.cs deleted file mode 100644 index a1ada47..0000000 --- a/src/Infrastructure/Persistence/Migrations/DataContextModelSnapshot.cs +++ /dev/null @@ -1,732 +0,0 @@ -// -using System; -using Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Infrastructure.Persistence.Migrations -{ - [DbContext(typeof(DataContext))] - partial class DataContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("AddedToLibrary") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Authors") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ColorTheme") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Normal"); - - b.Property("CoverLastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CoverSize") - .HasColumnType("bigint"); - - b.Property("CreationDate") - .HasMaxLength(140) - .HasColumnType("nvarchar(140)"); - - b.Property("Creator") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CurrentPage") - .HasColumnType("int"); - - b.Property("DocumentSize") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("Extension") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileHash") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue(""); - - b.Property("Format") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("HasCover") - .HasColumnType("bit"); - - b.Property("Language") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("LastModified") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastOpened") - .HasColumnType("nvarchar(max)"); - - b.Property("PageCount") - .HasColumnType("int"); - - b.Property("PagesSize") - .IsRequired() - .HasMaxLength(600) - .HasColumnType("nvarchar(600)"); - - b.Property("ParentFolderId") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("ProjectGutenbergId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); - - b.Property("Title") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Books"); - }); - - modelBuilder.Entity("Domain.Entities.Bookmark", b => - { - b.Property("BookmarkId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(5000) - .HasColumnType("nvarchar(max)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.Property("YOffset") - .HasColumnType("real"); - - b.HasKey("BookmarkId"); - - b.HasIndex("BookId"); - - b.ToTable("Bookmarks"); - }); - - modelBuilder.Entity("Domain.Entities.Folder", b => - { - b.Property("FolderId") - .HasColumnType("uniqueidentifier"); - - b.Property("Color") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(10000) - .HasColumnType("nvarchar(max)"); - - b.Property("Icon") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IndexInParent") - .HasColumnType("int"); - - b.Property("LastModified") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(5000) - .HasColumnType("nvarchar(max)"); - - b.Property("ParentFolderId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("FolderId"); - - b.HasIndex("ParentFolderId"); - - b.ToTable("Folders"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("Color") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("PageNumber") - .HasColumnType("int"); - - b.HasKey("HighlightId"); - - b.HasIndex("BookId"); - - b.ToTable("Highlights"); - }); - - modelBuilder.Entity("Domain.Entities.Product", b => - { - b.Property("ProductId") - .HasColumnType("nvarchar(450)"); - - b.Property("AiRequestLimit") - .HasColumnType("int"); - - b.Property("BookStorageLimit") - .HasColumnType("bigint"); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LiveMode") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Price") - .HasColumnType("int"); - - b.Property("PriceId") - .HasColumnType("nvarchar(max)"); - - b.HasKey("ProductId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("Domain.Entities.ProductFeature", b => - { - b.Property("ProductFeatureId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProductId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("ProductFeatureId"); - - b.HasIndex("ProductId"); - - b.ToTable("ProductFeature"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.Property("RectFId") - .HasColumnType("uniqueidentifier"); - - b.Property("Height") - .HasColumnType("real"); - - b.Property("HighlightId") - .HasColumnType("uniqueidentifier"); - - b.Property("Width") - .HasColumnType("real"); - - b.Property("X") - .HasColumnType("real"); - - b.Property("Y") - .HasColumnType("real"); - - b.HasKey("RectFId"); - - b.HasIndex("HighlightId"); - - b.ToTable("RectF"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.Property("BookId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationDate") - .HasColumnType("datetime2"); - - b.Property("Name") - .HasMaxLength(5000) - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("TagId"); - - b.HasIndex("BookId"); - - b.HasIndex("UserId"); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("AccountCreation") - .HasColumnType("datetime2"); - - b.Property("AccountLastDowngraded") - .HasColumnType("datetime2"); - - b.Property("AiExplanationRequestsMadeToday") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("CustomerId") - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("FirstName") - .HasMaxLength(40) - .HasColumnType("nvarchar(40)"); - - b.Property("HasProfilePicture") - .HasColumnType("bit"); - - b.Property("LastName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .HasMaxLength(150) - .HasColumnType("nvarchar(150)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("ProductId") - .HasColumnType("nvarchar(max)"); - - b.Property("ProfilePictureLastUpdated") - .HasColumnType("datetime2"); - - b.Property("RootFolderId") - .HasColumnType("uniqueidentifier"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.HasOne("Domain.Entities.User", "User") - .WithMany("Books") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Domain.Entities.Bookmark", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Bookmarks") - .HasForeignKey("BookId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.Folder", b => - { - b.HasOne("Domain.Entities.Folder", "ParentFolder") - .WithMany("Children") - .HasForeignKey("ParentFolderId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("ParentFolder"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.HasOne("Domain.Entities.Book", "Book") - .WithMany("Highlights") - .HasForeignKey("BookId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Book"); - }); - - modelBuilder.Entity("Domain.Entities.ProductFeature", b => - { - b.HasOne("Domain.Entities.Product", "Product") - .WithMany("Features") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("Domain.Entities.RectF", b => - { - b.HasOne("Domain.Entities.Highlight", "Highlight") - .WithMany("Rects") - .HasForeignKey("HighlightId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Highlight"); - }); - - modelBuilder.Entity("Domain.Entities.Tag", b => - { - b.HasOne("Domain.Entities.Book", null) - .WithMany("Tags") - .HasForeignKey("BookId"); - - b.HasOne("Domain.Entities.User", "User") - .WithMany("Tags") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Domain.Entities.Book", b => - { - b.Navigation("Bookmarks"); - - b.Navigation("Highlights"); - - b.Navigation("Tags"); - }); - - modelBuilder.Entity("Domain.Entities.Folder", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("Domain.Entities.Highlight", b => - { - b.Navigation("Rects"); - }); - - modelBuilder.Entity("Domain.Entities.Product", b => - { - b.Navigation("Features"); - }); - - modelBuilder.Entity("Domain.Entities.User", b => - { - b.Navigation("Books"); - - b.Navigation("Tags"); - }); -#pragma warning restore 612, 618 - } - } -} -- GitLab