refactor: rename UserWalletChangeLog→UserWalletHistory, add History interceptor & migration
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m11s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m11s
- Rename UserWalletChangeLog to UserWalletHistory across 54+ files (entities, configs, DTOs, commands, queries, protos, services) - Rename 34 files and 11 directories accordingly - Rename proto file userwalletchangelog.proto → userwallethistory.proto - Add IHasHistory<T> generic interface for history auto-tracking - Implement IHasHistory<PackageHistory> on Package entity - Add HistoryTrackingSaveChangesInterceptor (reflection-based, auto-fills Old* values from OriginalValues) - Wire interceptor in DI and ApplicationDbContext - Add EF migration Q27_HistoryTables_And_RenameWalletHistory: * RenameTable UserWalletChangeLogs → UserWalletHistories (preserves data) * Rename PK, FK constraints and indexes via sp_rename * CreateTable ClubMembershipCycleHistories + PackageHistories
This commit is contained in:
+195
-5
@@ -1935,6 +1935,81 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("States", "GMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.History.ClubMembershipCycleHistory", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<int>("Action")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("ClubMembershipCycleId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("CycleNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModifiedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("NewIsCurrentCycle")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("NewMagicCompletedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("NewMagicStartedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("OldIsCurrentCycle")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("OldMagicCompletedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("OldMagicStartedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("PerformedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<long>("UserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Action")
|
||||
.HasDatabaseName("IX_ClubMembershipCycleHistory_Action");
|
||||
|
||||
b.HasIndex("ClubMembershipCycleId")
|
||||
.HasDatabaseName("IX_ClubMembershipCycleHistory_CycleId");
|
||||
|
||||
b.HasIndex("UserId", "Created")
|
||||
.HasDatabaseName("IX_ClubMembershipCycleHistory_UserId_Created");
|
||||
|
||||
b.ToTable("ClubMembershipCycleHistories", "CMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.History.ClubMembershipHistory", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -2133,6 +2208,92 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("NetworkMembershipHistories", "CMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.History.PackageHistory", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<int>("Action")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModifiedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long?>("NewActivationFee")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool?>("NewIsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long?>("NewMagicMaxDeposit")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal?>("NewMagicMultiplier")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int?>("NewMaxBalancesPerLeg")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long?>("NewPrice")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long?>("OldActivationFee")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool?>("OldIsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long?>("OldMagicMaxDeposit")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal?>("OldMagicMultiplier")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int?>("OldMaxBalancesPerLeg")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long?>("OldPrice")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("PackageId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("PerformedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Action")
|
||||
.HasDatabaseName("IX_PackageHistory_Action");
|
||||
|
||||
b.HasIndex("PackageId", "Created")
|
||||
.HasDatabaseName("IX_PackageHistory_PackageId_Created");
|
||||
|
||||
b.ToTable("PackageHistories", "CMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.InventoryItem", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -3826,7 +3987,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("UserWallets", "CMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserWalletChangeLog", b =>
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserWalletHistory", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -3885,7 +4046,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
|
||||
b.HasIndex("WalletId");
|
||||
|
||||
b.ToTable("UserWalletChangeLogs", "CMS");
|
||||
b.ToTable("UserWalletHistories", "CMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Warehouse", b =>
|
||||
@@ -4430,6 +4591,17 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("Country");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.History.ClubMembershipCycleHistory", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.Club.ClubMembershipCycle", "ClubMembershipCycle")
|
||||
.WithMany("CycleHistories")
|
||||
.HasForeignKey("ClubMembershipCycleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ClubMembershipCycle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.History.ClubMembershipHistory", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.Club.ClubMembership", "ClubMembership")
|
||||
@@ -4460,6 +4632,17 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("WeekDefinition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.History.PackageHistory", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.Package", "Package")
|
||||
.WithMany("PackageHistories")
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Package");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.InventoryItem", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.DiscountShop.DiscountProduct", "DiscountProduct")
|
||||
@@ -4781,7 +4964,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserWalletChangeLog", b =>
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserWalletHistory", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.Package", "Package")
|
||||
.WithMany()
|
||||
@@ -4789,7 +4972,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.UserWallet", "Wallet")
|
||||
.WithMany("UserWalletChangeLogs")
|
||||
.WithMany("UserWalletHistories")
|
||||
.HasForeignKey("WalletId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@@ -4834,6 +5017,11 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("UserClubFeatures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Club.ClubMembershipCycle", b =>
|
||||
{
|
||||
b.Navigation("CycleHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Commission.UserCommissionPayout", b =>
|
||||
{
|
||||
b.Navigation("CommissionPayoutHistories");
|
||||
@@ -4901,6 +5089,8 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
b.Navigation("PackageFeatures");
|
||||
|
||||
b.Navigation("PackageHistories");
|
||||
|
||||
b.Navigation("Purchases");
|
||||
|
||||
b.Navigation("UserOrders");
|
||||
@@ -4984,7 +5174,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.UserWallet", b =>
|
||||
{
|
||||
b.Navigation("UserWalletChangeLogs");
|
||||
b.Navigation("UserWalletHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Warehouse", b =>
|
||||
|
||||
Reference in New Issue
Block a user