fix(tahesab): show missing docs and create local table if absent

Pending list was empty because a missing tahesab table hid unsynced orders and charges. Create the table when needed and keep customer on each row.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-02 21:51:21 +03:30
co-authored by Cursor
parent ad12de87c7
commit bb52e4c35a
3 changed files with 136 additions and 65 deletions
@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (Schema::hasTable('tahesab')) {
return;
}
Schema::create('tahesab', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('customer_id')->nullable()->index();
$table->unsignedBigInteger('order_id')->nullable()->index();
$table->unsignedBigInteger('withdraw_id')->nullable()->index();
$table->decimal('amount', 18, 4)->nullable();
$table->string('desc')->nullable();
$table->string('type', 32)->nullable();
$table->timestamp('date')->nullable();
$table->string('tahesab_id')->nullable()->index();
$table->string('sh_factor')->nullable();
$table->string('factor_number')->nullable();
$table->string('tah_id')->nullable();
$table->longText('data')->nullable();
$table->longText('res')->nullable();
$table->string('sync_status', 20)->default('pending');
$table->text('sync_log')->nullable();
$table->timestamps();
});
}
public function down(): void
{
// جدول ممکن است از قبل روی نصب‌های قدیمی بوده باشد؛ drop نمی‌کنیم.
}
};