Spaces:
Sleeping
Sleeping
| // <auto-generated /> | |
| using System; | |
| using DbConnect.Data; | |
| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.EntityFrameworkCore.Infrastructure; | |
| using Microsoft.EntityFrameworkCore.Migrations; | |
| using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | |
| using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | |
| namespace DbConnect.Migrations | |
| { | |
| [] | |
| [] | |
| partial class InitialPostgres | |
| { | |
| /// <inheritdoc /> | |
| protected override void BuildTargetModel(ModelBuilder modelBuilder) | |
| { | |
| modelBuilder | |
| .HasAnnotation("ProductVersion", "9.0.0") | |
| .HasAnnotation("Relational:MaxIdentifierLength", 63); | |
| NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); | |
| modelBuilder.Entity("BookCategory", b => | |
| { | |
| b.Property<int>("BookId") | |
| .HasColumnType("integer"); | |
| b.Property<int>("CategoryId") | |
| .HasColumnType("integer"); | |
| b.HasKey("BookId", "CategoryId") | |
| .HasName("PK__BookCate__9C7051A74E7D221D"); | |
| b.HasIndex("CategoryId"); | |
| b.ToTable("BookCategories", (string)null); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Book", b => | |
| { | |
| b.Property<int>("Id") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("integer"); | |
| NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); | |
| b.Property<string>("Author") | |
| .IsRequired() | |
| .HasMaxLength(100) | |
| .HasColumnType("character varying(100)"); | |
| b.Property<int>("AvailableCopies") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("integer") | |
| .HasDefaultValue(1); | |
| b.Property<string>("CoverUrl") | |
| .HasColumnType("text"); | |
| b.Property<DateTime>("CreatedAt") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("timestamp") | |
| .HasDefaultValueSql("now()"); | |
| b.Property<string>("Description") | |
| .HasColumnType("text"); | |
| b.Property<bool>("IsActive") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("boolean") | |
| .HasDefaultValue(true); | |
| b.Property<string>("Isbn") | |
| .IsRequired() | |
| .HasMaxLength(20) | |
| .HasColumnType("character varying(20)") | |
| .HasColumnName("ISBN"); | |
| b.Property<string>("Status") | |
| .IsRequired() | |
| .ValueGeneratedOnAdd() | |
| .HasMaxLength(20) | |
| .HasColumnType("character varying(20)") | |
| .HasDefaultValue("Available"); | |
| b.Property<string>("Title") | |
| .IsRequired() | |
| .HasMaxLength(200) | |
| .HasColumnType("character varying(200)"); | |
| b.Property<int>("TotalCopies") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("integer") | |
| .HasDefaultValue(1); | |
| b.Property<DateTime?>("UpdatedAt") | |
| .HasColumnType("timestamp"); | |
| b.HasKey("Id") | |
| .HasName("PK__Books__3214EC07AE1974C8"); | |
| b.HasIndex(new[] { "Isbn" }, "UQ__Books__447D36EA79CF66CE") | |
| .IsUnique(); | |
| b.ToTable("Books"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Borrowing", b => | |
| { | |
| b.Property<Guid>("Id") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("uuid") | |
| .HasDefaultValueSql("gen_random_uuid()"); | |
| b.Property<int>("BookId") | |
| .HasColumnType("integer"); | |
| b.Property<DateTime>("BorrowDate") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("timestamp") | |
| .HasDefaultValueSql("now()"); | |
| b.Property<DateTime>("DueDate") | |
| .HasColumnType("timestamp"); | |
| b.Property<decimal>("FineAmount") | |
| .HasColumnType("decimal(10, 2)"); | |
| b.Property<bool>("IsFinePaid") | |
| .HasColumnType("boolean"); | |
| b.Property<DateTime?>("ReturnDate") | |
| .HasColumnType("timestamp"); | |
| b.Property<string>("Status") | |
| .IsRequired() | |
| .ValueGeneratedOnAdd() | |
| .HasMaxLength(20) | |
| .HasColumnType("character varying(20)") | |
| .HasDefaultValue("Active"); | |
| b.Property<Guid>("UserId") | |
| .HasColumnType("uuid"); | |
| b.HasKey("Id"); | |
| b.HasIndex("BookId"); | |
| b.HasIndex("UserId"); | |
| b.ToTable("Borrowings"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Category", b => | |
| { | |
| b.Property<int>("Id") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("integer"); | |
| NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); | |
| b.Property<string>("Name") | |
| .IsRequired() | |
| .HasMaxLength(100) | |
| .HasColumnType("character varying(100)"); | |
| b.HasKey("Id") | |
| .HasName("PK__Categori__3214EC0751B5797D"); | |
| b.HasIndex(new[] { "Name" }, "UQ__Categori__737584F622B16D3A") | |
| .IsUnique(); | |
| b.ToTable("Categories"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Membership", b => | |
| { | |
| b.Property<int>("Id") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("integer"); | |
| NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); | |
| b.Property<int>("BorrowingDays") | |
| .HasColumnType("integer"); | |
| b.Property<int>("DurationMonths") | |
| .HasColumnType("integer"); | |
| b.Property<int>("MaxBooks") | |
| .HasColumnType("integer"); | |
| b.Property<decimal>("Price") | |
| .HasColumnType("decimal(10, 2)"); | |
| b.Property<string>("RewardId") | |
| .HasMaxLength(100) | |
| .HasColumnType("character varying(100)"); | |
| b.Property<string>("Type") | |
| .IsRequired() | |
| .HasMaxLength(50) | |
| .HasColumnType("character varying(50)"); | |
| b.HasKey("Id") | |
| .HasName("PK__Membersh__3214EC07A6F5A55F"); | |
| b.HasIndex(new[] { "Type" }, "IX_Memberships_Type") | |
| .IsUnique(); | |
| b.ToTable("Memberships"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Notification", b => | |
| { | |
| b.Property<int>("Id") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("integer"); | |
| NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); | |
| b.Property<string>("ActionLink") | |
| .HasMaxLength(500) | |
| .HasColumnType("character varying(500)"); | |
| b.Property<string>("ActionText") | |
| .HasMaxLength(100) | |
| .HasColumnType("character varying(100)"); | |
| b.Property<DateTime>("CreatedAt") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("timestamp") | |
| .HasDefaultValueSql("now()"); | |
| b.Property<bool>("IsRead") | |
| .HasColumnType("boolean"); | |
| b.Property<string>("Message") | |
| .IsRequired() | |
| .HasMaxLength(1000) | |
| .HasColumnType("character varying(1000)"); | |
| b.Property<string>("Title") | |
| .IsRequired() | |
| .HasMaxLength(200) | |
| .HasColumnType("character varying(200)"); | |
| b.Property<string>("Type") | |
| .IsRequired() | |
| .ValueGeneratedOnAdd() | |
| .HasMaxLength(50) | |
| .HasColumnType("character varying(50)") | |
| .HasDefaultValue("Info"); | |
| b.Property<Guid>("UserId") | |
| .HasColumnType("uuid"); | |
| b.HasKey("Id"); | |
| b.HasIndex(new[] { "UserId" }, "IX_Notifications_UserId"); | |
| b.ToTable("Notifications"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.User", b => | |
| { | |
| b.Property<Guid>("Id") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("uuid") | |
| .HasDefaultValueSql("gen_random_uuid()"); | |
| b.Property<string>("Address") | |
| .HasMaxLength(255) | |
| .HasColumnType("character varying(255)"); | |
| b.Property<bool?>("BanStatus") | |
| .HasColumnType("boolean"); | |
| b.Property<DateTime>("CreatedAt") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("timestamp") | |
| .HasDefaultValueSql("now()"); | |
| b.Property<string>("Email") | |
| .IsRequired() | |
| .HasMaxLength(100) | |
| .HasColumnType("character varying(100)"); | |
| b.Property<string>("FcmToken") | |
| .HasMaxLength(500) | |
| .HasColumnType("character varying(500)"); | |
| b.Property<string>("FullName") | |
| .IsRequired() | |
| .HasMaxLength(100) | |
| .HasColumnType("character varying(100)"); | |
| b.Property<bool>("IsActive") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("boolean") | |
| .HasDefaultValue(true); | |
| b.Property<string>("PasswordHash") | |
| .IsRequired() | |
| .HasColumnType("text"); | |
| b.Property<string>("PhoneNumber") | |
| .HasMaxLength(20) | |
| .HasColumnType("character varying(20)"); | |
| b.Property<string>("Role") | |
| .IsRequired() | |
| .ValueGeneratedOnAdd() | |
| .HasMaxLength(20) | |
| .HasColumnType("character varying(20)") | |
| .HasDefaultValue("User"); | |
| b.Property<string>("StudentId") | |
| .HasMaxLength(20) | |
| .HasColumnType("character varying(20)"); | |
| b.Property<DateTime?>("SuspensionEndDate") | |
| .HasColumnType("timestamp"); | |
| b.Property<DateTime?>("UpdatedAt") | |
| .HasColumnType("timestamp"); | |
| b.HasKey("Id"); | |
| b.HasIndex(new[] { "Email" }, "UQ_Users_Email") | |
| .IsUnique(); | |
| b.ToTable("Users"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.UserSubscription", b => | |
| { | |
| b.Property<Guid>("Id") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("uuid") | |
| .HasDefaultValueSql("gen_random_uuid()"); | |
| b.Property<DateTime>("ExpiryDate") | |
| .HasColumnType("timestamp"); | |
| b.Property<string>("ExternalRedemptionId") | |
| .HasMaxLength(100) | |
| .HasColumnType("character varying(100)"); | |
| b.Property<bool>("IsActive") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("boolean") | |
| .HasDefaultValue(true); | |
| b.Property<int>("MembershipId") | |
| .HasColumnType("integer"); | |
| b.Property<DateTime>("StartDate") | |
| .HasColumnType("timestamp"); | |
| b.Property<string>("Status") | |
| .IsRequired() | |
| .ValueGeneratedOnAdd() | |
| .HasMaxLength(20) | |
| .HasColumnType("character varying(20)") | |
| .HasDefaultValue("Active"); | |
| b.Property<Guid>("UserId") | |
| .HasColumnType("uuid"); | |
| b.HasKey("Id"); | |
| b.HasIndex("MembershipId"); | |
| b.HasIndex("UserId"); | |
| b.ToTable("UserSubscriptions"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.WishlistItem", b => | |
| { | |
| b.Property<int>("Id") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("integer"); | |
| NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); | |
| b.Property<DateTime>("AddedAt") | |
| .ValueGeneratedOnAdd() | |
| .HasColumnType("timestamp") | |
| .HasDefaultValueSql("now()"); | |
| b.Property<int>("BookId") | |
| .HasColumnType("integer"); | |
| b.Property<Guid>("UserId") | |
| .HasColumnType("uuid"); | |
| b.HasKey("Id"); | |
| b.HasIndex(new[] { "BookId" }, "IX_WishlistItems_BookId"); | |
| b.HasIndex(new[] { "UserId" }, "IX_WishlistItems_UserId"); | |
| b.ToTable("WishlistItems"); | |
| }); | |
| modelBuilder.Entity("BookCategory", b => | |
| { | |
| b.HasOne("DbConnect.Entities.Book", null) | |
| .WithMany() | |
| .HasForeignKey("BookId") | |
| .OnDelete(DeleteBehavior.Cascade) | |
| .IsRequired() | |
| .HasConstraintName("FK_BookCategories_Books"); | |
| b.HasOne("DbConnect.Entities.Category", null) | |
| .WithMany() | |
| .HasForeignKey("CategoryId") | |
| .OnDelete(DeleteBehavior.Cascade) | |
| .IsRequired() | |
| .HasConstraintName("FK_BookCategories_Categories"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Borrowing", b => | |
| { | |
| b.HasOne("DbConnect.Entities.Book", "Book") | |
| .WithMany("Borrowings") | |
| .HasForeignKey("BookId") | |
| .IsRequired() | |
| .HasConstraintName("FK_Borrowings_Books"); | |
| b.HasOne("DbConnect.Entities.User", "User") | |
| .WithMany("Borrowings") | |
| .HasForeignKey("UserId") | |
| .IsRequired() | |
| .HasConstraintName("FK_Borrowings_Users"); | |
| b.Navigation("Book"); | |
| b.Navigation("User"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Notification", b => | |
| { | |
| b.HasOne("DbConnect.Entities.User", "User") | |
| .WithMany("Notifications") | |
| .HasForeignKey("UserId") | |
| .OnDelete(DeleteBehavior.Cascade) | |
| .IsRequired() | |
| .HasConstraintName("FK_Notifications_Users"); | |
| b.Navigation("User"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.UserSubscription", b => | |
| { | |
| b.HasOne("DbConnect.Entities.Membership", "Membership") | |
| .WithMany("UserSubscriptions") | |
| .HasForeignKey("MembershipId") | |
| .IsRequired() | |
| .HasConstraintName("FK_UserSubscriptions_Memberships"); | |
| b.HasOne("DbConnect.Entities.User", "User") | |
| .WithMany("UserSubscriptions") | |
| .HasForeignKey("UserId") | |
| .IsRequired() | |
| .HasConstraintName("FK_UserSubscriptions_Users"); | |
| b.Navigation("Membership"); | |
| b.Navigation("User"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.WishlistItem", b => | |
| { | |
| b.HasOne("DbConnect.Entities.Book", "Book") | |
| .WithMany("WishlistItems") | |
| .HasForeignKey("BookId") | |
| .OnDelete(DeleteBehavior.Cascade) | |
| .IsRequired() | |
| .HasConstraintName("FK_WishlistItems_Books"); | |
| b.HasOne("DbConnect.Entities.User", "User") | |
| .WithMany("WishlistItems") | |
| .HasForeignKey("UserId") | |
| .OnDelete(DeleteBehavior.Cascade) | |
| .IsRequired() | |
| .HasConstraintName("FK_WishlistItems_Users"); | |
| b.Navigation("Book"); | |
| b.Navigation("User"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Book", b => | |
| { | |
| b.Navigation("Borrowings"); | |
| b.Navigation("WishlistItems"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.Membership", b => | |
| { | |
| b.Navigation("UserSubscriptions"); | |
| }); | |
| modelBuilder.Entity("DbConnect.Entities.User", b => | |
| { | |
| b.Navigation("Borrowings"); | |
| b.Navigation("Notifications"); | |
| b.Navigation("UserSubscriptions"); | |
| b.Navigation("WishlistItems"); | |
| }); | |
| } | |
| } | |
| } | |