//
using System;
using CMSMicroservice.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 CMSMicroservice.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251013044349_u04")]
partial class u04
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("CMS")
.HasAnnotation("ProductVersion", "7.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("CMSMicroservice.Domain.Entities.OtpToken", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Attempts")
.HasColumnType("int");
b.Property("CodeHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Created")
.HasColumnType("datetime2");
b.Property("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property("ExpiresAt")
.HasColumnType("datetime2");
b.Property("IsDeleted")
.HasColumnType("bit");
b.Property("IsUsed")
.HasColumnType("bit");
b.Property("LastModified")
.HasColumnType("datetime2");
b.Property("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property("Mobile")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Purpose")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("OtpTokens", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Package", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Created")
.HasColumnType("datetime2");
b.Property("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("ImagePath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("IsDeleted")
.HasColumnType("bit");
b.Property("LastModified")
.HasColumnType("datetime2");
b.Property("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property("Price")
.HasColumnType("bigint");
b.Property("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Role", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Created")
.HasColumnType("datetime2");
b.Property("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property("IsDeleted")
.HasColumnType("bit");
b.Property("LastModified")
.HasColumnType("datetime2");
b.Property("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("AvatarPath")
.HasColumnType("nvarchar(max)");
b.Property("BirthDate")
.HasColumnType("datetime2");
b.Property("Created")
.HasColumnType("datetime2");
b.Property("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property("EmailNotifications")
.HasColumnType("bit");
b.Property("FirstName")
.HasColumnType("nvarchar(max)");
b.Property("IsDeleted")
.HasColumnType("bit");
b.Property("IsMobileVerified")
.HasColumnType("bit");
b.Property("IsRulesAccepted")
.HasColumnType("bit");
b.Property("LastModified")
.HasColumnType("datetime2");
b.Property("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property("LastName")
.HasColumnType("nvarchar(max)");
b.Property("Mobile")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("MobileVerifiedAt")
.HasColumnType("datetime2");
b.Property("NationalCode")
.HasColumnType("nvarchar(max)");
b.Property("ParentId")
.HasColumnType("bigint");
b.Property("PushNotifications")
.HasColumnType("bit");
b.Property("ReferralCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("RulesAcceptedAt")
.HasColumnType("datetime2");
b.Property("SmsNotifications")
.HasColumnType("bit");
b.HasKey("Id");
b.HasIndex("ParentId");
b.ToTable("Users", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserAddress", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("CityId")
.HasColumnType("bigint");
b.Property("Created")
.HasColumnType("datetime2");
b.Property("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property("IsDefault")
.HasColumnType("bit");
b.Property("IsDeleted")
.HasColumnType("bit");
b.Property("LastModified")
.HasColumnType("datetime2");
b.Property("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property("PostalCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("UserAddresss", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserOrder", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Created")
.HasColumnType("datetime2");
b.Property("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property("IsDeleted")
.HasColumnType("bit");
b.Property("LastModified")
.HasColumnType("datetime2");
b.Property("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property("PackageId")
.HasColumnType("bigint");
b.Property("PaymentDate")
.HasColumnType("datetime2");
b.Property("PaymentStatus")
.HasColumnType("bit");
b.Property("Price")
.HasColumnType("bigint");
b.Property("TransactionId")
.HasColumnType("bigint");
b.Property("UserAddressId")
.HasColumnType("bigint");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("PackageId");
b.HasIndex("UserAddressId");
b.HasIndex("UserId");
b.ToTable("UserOrders", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserRole", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Created")
.HasColumnType("datetime2");
b.Property("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property("IsDeleted")
.HasColumnType("bit");
b.Property("LastModified")
.HasColumnType("datetime2");
b.Property("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property("RoleId")
.HasColumnType("bigint");
b.Property("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("UserRoles", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.User", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.User", "Parent")
.WithMany("Users")
.HasForeignKey("ParentId");
b.Navigation("Parent");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserAddress", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.User", "User")
.WithMany("UserAddresss")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserOrder", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Package", "Package")
.WithMany("UserOrders")
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CMSMicroservice.Domain.Entities.UserAddress", "UserAddress")
.WithMany("UserOrders")
.HasForeignKey("UserAddressId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("CMSMicroservice.Domain.Entities.User", "User")
.WithMany("UserOrders")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Package");
b.Navigation("User");
b.Navigation("UserAddress");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserRole", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CMSMicroservice.Domain.Entities.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Package", b =>
{
b.Navigation("UserOrders");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Role", b =>
{
b.Navigation("UserRoles");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.User", b =>
{
b.Navigation("UserAddresss");
b.Navigation("UserOrders");
b.Navigation("UserRoles");
b.Navigation("Users");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserAddress", b =>
{
b.Navigation("UserOrders");
});
#pragma warning restore 612, 618
}
}
}