generated from seatplus/package-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/seed schedules with default (#4)
* fix phpstan config * fix test workflow * schedule default commands through migration
- Loading branch information
1 parent
6e28fab
commit 22d4550
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
database/migrations/2023_06_08_215017_seed_schedule_tables_with_default_expressions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Seatplus\Eveapi\Models\Schedules; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
|
||
$jobs = [ | ||
// Run ApplyNicknamePolicy Command every 15 minutes | ||
\Seatplus\Tribe\Commands\ApplyNicknamePolicyCommand::class => '*/15 * * * *', | ||
// Run RunSquadSyncCommand every 15 minutes | ||
\Seatplus\Tribe\Commands\RunSquadSyncCommand::class => '*/15 * * * *', | ||
]; | ||
// if the schedule is not in the database, create it | ||
foreach ($jobs as $job => $schedule) { | ||
Schedules::query()->firstOrCreate([ | ||
'job' => $job, | ||
], [ | ||
'expression' => $schedule, | ||
]); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters