fix trigger bug 2
This commit is contained in:
@@ -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
|
||||
|
||||
+31
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user