docs: Phase 10 — DataMigration + EF Staging + PackagePurchaseDialog + UI Fixes

Updated 8 docs:
- CHANGELOG: Phase 10a-d (DataMigration tool, EF staging migrations, PackagePurchaseDialog, 4 UI fixes)
- PAYMENT-FINANCE: Rial→Toman conversion chain documented, PackagePurchaseDialog status
- TECH-02: Added PackagePurchaseDialog to folder structure + status table
- TECH-04: DataMigration tool features (smart retry, FK handling, fallback tables), EF staging
- PACKAGE-TASKS: Phase 10 graph, NuGet v0.0.189, T4.1+T4.2 marked 
- BIZ-PACKAGE: v6→v7, commits updated, T4.1+T4.2 marked 
- INDEX: Updated last-update + R3 description
- ROADMAP: Progress bars updated, DONE section + NOW section refreshed
This commit is contained in:
masoodafar-web
2026-02-27 20:56:00 +03:30
parent de69bf862c
commit 39590d2cbe
8 changed files with 136 additions and 35 deletions
+32 -12
View File
@@ -1,7 +1,7 @@
# 🔄 مهاجرت داده، BFF و Gateway
> **منابع ادغام‌شده:** `BACKOFFICE-BFF-MIGRATION.md`, `customer-facing-capabilities-codex.md`, `DATA-TABLE-MAPPINGS.md`, `DATAMIGRATION-README.md`, `FRONTOFFICE-TO-CMS-MIGRATION.md`, `GATEWAY-REMOVAL-MIGRATION-PLAN.md`, `MIGRATION-PROGRESS.md`
> **آخرین بروزرسانی:** اسفند ۱۴۰۴ (بروزرسانی: Migration پروداکشن)
> **آخرین بروزرسانی:** اسفند ۱۴۰۴ (بروزرسانی: DataMigration Tool + EF Staging Migrations)
---
@@ -136,15 +136,15 @@ Proto-generated classes مستقیم در UI استفاده می‌شوند
```
DataMigration/
├── FourSat.DataMigration/ ← Console app
│ ├── Program.cs
│ ├── Migrators/
│ ├── UserMigrator.cs
│ │ ── ProductMigrator.cs
│ ├── OrderMigrator.cs
│ │ └── ClubMigrator.cs
├── FourSat.DataMigration/ ← Console app (.NET 9 + Dapper + Polly + Serilog)
│ ├── Program.cs ← Entry point
│ ├── appsettings.json ← Source/Target connection strings + TruncateTargetTables
│ ├── Services/
│ │ ── MigrationService.cs ← Smart retry, FK disable/enable, fallback table names
│ ├── Scripts/
│ │ └── PostMigration_DataTransformation.sql ← Guardشده با IF COL_LENGTH/OBJECT_ID
│ └── Mappings/
│ └── TableMappings.cs
│ └── TableMappings.cs ← Source → Target table/column mappings
└── FourSat.GeographySeeder/ ← Seed geography data
├── Program.cs
└── Data/
@@ -152,6 +152,21 @@ DataMigration/
└── cities.json
```
### ۵.۱.۱ ویژگی‌های DataMigration Tool (اسفند ۱۴۰۴)
| ویژگی | توضیح |
|--------|--------|
| **Smart Retry** | فقط خطاهای transient SQL (deadlock, timeout, transport) — نه خطاهای منطقی |
| **FK Disable/Enable** | `ALTER TABLE NOCHECK/CHECK CONSTRAINT ALL` حول هر مهاجرت |
| **TruncateTargetTables** | حل duplicate key (`IX_ClubMembership_UserId`) هنگام re-run |
| **Fallback Table Name** | اگر جدول rename شده (`UserWalletChangeLogs``UserWalletHistories`) |
| **PostMigration Guards** | همه مراحل با `IF COL_LENGTH`/`OBJECT_ID` برای سازگاری با هر دو schema |
| **Polly Retry** | exponential backoff (2s, 8s, 32s) + لاگ structured |
| **Serilog** | لاگ فایل + کنسول با جزئیات هر جدول |
> **کامیت‌ها:** `0e8c6fd` → `8385c90` (MERGE fix) → `31cc464` (FK+truncate+PostMigration)
> **وضعیت:** Local only — بدون remote (در workspace `DataMigration/` قرار دارد)
### ۵.۲ Data Table Mappings
| جدول مبدأ (قدیم) | جدول مقصد (CMS) | نکات |
@@ -178,14 +193,17 @@ DataMigration/
| `populate-weekly-commission-pools.sql` | داده تاریخی Pool |
| `update_products_price_10_percent.sql` | افزایش قیمت ۱۰% |
### ۵.۴ Migrationهای EF Core اجراشده روی Production (اسفند ۱۴۰۴)
### ۵.۴ Migrationهای EF Core اجراشده روی Production/Staging (اسفند ۱۴۰۴)
| Migration | توضیح | DB |
|-----------|--------|----|
|-----------|--------|----||
| `ExpandDiscountProductFullInformation` | گسترش فیلدهای محصول تخفیفی | KBS (Production `45.149.79.127`) |
| `AddMagicWalletFields` (u21) | فیلدهای کیف‌پول جادویی + ClubMembershipCycle | KBS (Production) |
| ۵۵ migration کامل | از Initial تا `Q27_HistoryTables_And_RenameWalletHistory` | KBS Staging (`185.252.31.42,2019/KBS`) |
| ۵۵ migration کامل | از Initial تا `Q27_HistoryTables_And_RenameWalletHistory` | App DB (`194.5.195.53,31433/Foursat`) |
> ⚠️ نکته: Migration `u21` در زمان merge تکراری بود (timestampهای `20260222155925` و `20260222160755`). فایل تکراری حذف شد.
> ✅ **نکته:** CMS به ۲ DB مختلف وصل می‌شود — هر دو باید migrate شوند.
> ✅ Migration `u21` در زمان merge تکراری بود — فایل تکراری حذف شد.
---
@@ -236,3 +254,5 @@ FourSat.GeographySeeder:
| Geography Seeder | ✅ | 100% |
| Proto package unification | ✅ | 100% |
| EF Migration پروداکشن | ✅ | 100% |
| DataMigration Tool (Prod→Staging) | ✅ | 100% |
| EF Migration استیجینگ (KBS + Foursat) | ✅ | 100% |