feat(schedule): add schedule:bootstrap and minute-precise automation runs
Install per-module schedule:run cron from artisan, store sms/in_app send minutes, and match scheduled triggers at exact HH:mm Tehran time. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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('automations')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('automations', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('automations', 'sms_send_minute')) {
|
||||
$table->unsignedTinyInteger('sms_send_minute')->nullable()->after('sms_send_hour');
|
||||
}
|
||||
if (! Schema::hasColumn('automations', 'in_app_send_minute')) {
|
||||
$table->unsignedTinyInteger('in_app_send_minute')->nullable()->after('in_app_send_hour');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('automations')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('automations', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('automations', 'sms_send_minute')) {
|
||||
$table->dropColumn('sms_send_minute');
|
||||
}
|
||||
if (Schema::hasColumn('automations', 'in_app_send_minute')) {
|
||||
$table->dropColumn('in_app_send_minute');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user