added tahesab options

This commit is contained in:
2026-06-25 22:20:40 +03:30
parent 936cc88e53
commit e6e1ff0cc4
11 changed files with 411 additions and 144 deletions
@@ -0,0 +1,42 @@
<?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::table('tahesab', function (Blueprint $table) {
if (! Schema::hasColumn('tahesab', 'sync_status')) {
$table->string('sync_status', 20)->default('pending')->after('type');
}
if (! Schema::hasColumn('tahesab', 'sync_log')) {
$table->text('sync_log')->nullable()->after('sync_status');
}
if (! Schema::hasColumn('tahesab', 'withdraw_id')) {
$table->unsignedBigInteger('withdraw_id')->nullable()->after('order_id');
}
});
}
public function down(): void
{
if (! Schema::hasTable('tahesab')) {
return;
}
Schema::table('tahesab', function (Blueprint $table) {
foreach (['sync_status', 'sync_log', 'withdraw_id'] as $column) {
if (Schema::hasColumn('tahesab', $column)) {
$table->dropColumn($column);
}
}
});
}
};
+12
View File
@@ -0,0 +1,12 @@
-- Manual fix when php artisan migrate does not apply (e.g. baseline already registered).
-- Adds sync tracking columns to tahesab table.
ALTER TABLE `tahesab`
ADD COLUMN IF NOT EXISTS `sync_status` VARCHAR(20) NOT NULL DEFAULT 'pending' AFTER `type`,
ADD COLUMN IF NOT EXISTS `sync_log` TEXT NULL AFTER `sync_status`,
ADD COLUMN IF NOT EXISTS `withdraw_id` BIGINT UNSIGNED NULL AFTER `order_id`;
-- MySQL < 8.0.12 does not support IF NOT EXISTS on ADD COLUMN; use these instead if the above fails:
-- ALTER TABLE `tahesab` ADD COLUMN `sync_status` VARCHAR(20) NOT NULL DEFAULT 'pending' AFTER `type`;
-- ALTER TABLE `tahesab` ADD COLUMN `sync_log` TEXT NULL AFTER `sync_status`;
-- ALTER TABLE `tahesab` ADD COLUMN `withdraw_id` BIGINT UNSIGNED NULL AFTER `order_id`;