This commit is contained in:
masoodafar-web
2026-01-03 18:27:49 +03:30
parent 0369292d7f
commit 5965b98728
156 changed files with 16082 additions and 0 deletions
@@ -0,0 +1,147 @@
# 🚀 راهنمای سریع - FourSat Data Migration
## قدم 1: ویرایش تنظیمات
```bash
cd /home/masoud/Apps/project/FourSat/DataMigration/FourSat.DataMigration
nano appsettings.json
```
**تغییرات ضروری:**
```json
{
"ConnectionStrings": {
"SourceDatabase": "Server=185.252.31.42,2019;Database=Foursat;User Id=YOUR_USERNAME;Password=YOUR_PASSWORD;TrustServerCertificate=True;Encrypt=False;",
"TargetDatabase": "Server=194.5.195.53,31433;Database=Foursat;User Id=YOUR_USERNAME;Password=YOUR_PASSWORD;TrustServerCertificate=True;Encrypt=False;"
}
}
```
⚠️ حتماً `YOUR_USERNAME` و `YOUR_PASSWORD` را وارد کنید!
---
## قدم 2: اجرای Migration
```bash
dotnet run
```
**خروجی مورد انتظار:**
```
[12:30:15 INF] === FourSat Data Migration Tool ===
[12:30:15 INF] Starting application...
[12:30:16 INF] === Starting Data Migration ===
[12:30:16 INF] Source: Server=185.252.31.42,2019
[12:30:16 INF] Target: Server=194.5.195.53,31433
[12:30:17 INF] Source: 33 tables found
[12:30:17 INF] Mapping: Categorys → Categories
[12:30:17 INF] Mapping: Productss → Products
[12:30:17 INF] Mapping: FactorDetailss → FactorDetails
... (همه 33 table)
[12:35:42 INF] === Migration Complete ===
[12:35:42 INF] Success: 33 tables, 50,000+ records
[12:35:42 INF] Failed: 0 tables
[12:35:42 INF] Duration: 00:05:27
[12:35:42 INF] === Starting Post-Migration Data Transformation ===
[12:35:46 INF] Post-migration transformation completed successfully
```
---
## قدم 3: بررسی Logs
### Console (Real-time):
- لاگ‌ها مستقیماً در terminal نمایش داده می‌شوند
### File (برای بررسی بعدی):
```bash
ls -lh Logs/
cat Logs/migration-20251206.txt
# یا
tail -f Logs/migration-20251206.txt # Real-time
```
---
## توقف (در صورت نیاز)
```bash
Ctrl+C
```
⚠️ **توجه**: Migration از وسط متوقف می‌شود. برای ادامه باید:
1. Target database را TRUNCATE کنید
2. دوباره `dotnet run` کنید
---
## عیب‌یابی سریع
### خطا: "Login failed"
```bash
# چک کنید: Username/Password در appsettings.json
# چک کنید: IP شما در Firewall مجاز است
```
### خطا: "Table not found"
```bash
# بررسی: Table در Target database وجود دارد؟
# راه حل: Migration بزنید یا Table را ایجاد کنید
```
### خطا: "Timeout"
```bash
# راه حل: در appsettings.json BatchSize را کم کنید
"BatchSize": 500 # به جای 1000
```
---
## تنظیمات پیشرفته
### برای سرعت بیشتر (Network سریع):
```json
{
"MigrationSettings": {
"BatchSize": 5000,
"MaxConcurrentTables": 5
}
}
```
### برای پایداری بیشتر (Network کند):
```json
{
"MigrationSettings": {
"BatchSize": 500,
"MaxConcurrentTables": 2,
"MaxRetryAttempts": 10
}
}
```
---
## حذف پروژه (بعد از اتمام کار)
```bash
cd /home/masoud/Apps/project/FourSat
rm -rf DataMigration/
```
---
## پشتیبانی
**در صورت خطا:**
1. لاگ فایل را بررسی کنید: `Logs/migration-*.txt`
2. خطای کامل را یادداشت کنید
3. با تیم Dev در میان بگذارید
---
**نسخه:** 1.0
**تاریخ:** December 6, 2025
**وضعیت:** ✅ آماده برای استفاده