fix trigger bug 2

This commit is contained in:
2026-07-22 14:15:22 +03:30
parent 7d02639917
commit 8165fc37b8
6 changed files with 52 additions and 7 deletions
@@ -21,7 +21,7 @@ return new class extends Migration
$table->unsignedBigInteger('trigger_price');
$table->decimal('amount', 16, 4)->nullable();
$table->decimal('number', 16, 4)->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->dateTime('expires_at')->nullable()->index();
$table->text('description')->nullable();
$table->boolean('is_active')->default(true);
$table->string('status', 16)->default('pending')->index(); // pending|executed|failed|expired
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* TIMESTAMP + app Asia/Tehran + MySQL session TZ caused double conversion:
* user 17:05 Tehran was stored ~3.5h earlier and expired immediately.
* DATETIME keeps the wall-clock the user/admin picked.
*/
return new class extends Migration
{
public function up(): void
{
if (! Schema::hasTable('conditional_orders')) {
return;
}
DB::statement('ALTER TABLE `conditional_orders` MODIFY COLUMN `expires_at` DATETIME NULL');
}
public function down(): void
{
if (! Schema::hasTable('conditional_orders')) {
return;
}
DB::statement('ALTER TABLE `conditional_orders` MODIFY COLUMN `expires_at` TIMESTAMP NULL');
}
};