-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
micha
committed
Jan 5, 2023
1 parent
2d43520
commit 0dcb652
Showing
3 changed files
with
59 additions
and
0 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
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
57 changes: 57 additions & 0 deletions
57
migrations/2023_01_06_200435_add_triggers_to_schuduler_watcher_tables.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,57 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
|
||
public function up(): void | ||
{ | ||
DB::connection(config('laravel-scheduler-watcher.mysql_connection'))->unprepared(' | ||
CREATE | ||
TRIGGER tr_bi_jobs | ||
BEFORE INSERT | ||
ON jobs | ||
FOR EACH ROW | ||
BEGIN | ||
SET NEW.job_db_created = NOW(); | ||
END'); | ||
DB::connection(config('laravel-scheduler-watcher.mysql_connection'))->unprepared(' | ||
CREATE | ||
TRIGGER tr_bi_job_events | ||
BEFORE INSERT | ||
ON job_events | ||
FOR EACH ROW | ||
BEGIN | ||
SET NEW.jobe_db_created = NOW(); | ||
END'); | ||
DB::connection(config('laravel-scheduler-watcher.mysql_connection'))->unprepared(' | ||
CREATE | ||
TRIGGER tr_bu_job_events | ||
BEFORE UPDATE | ||
ON job_events | ||
FOR EACH ROW | ||
BEGIN | ||
SET NEW.jobe_db_changed = NOW(); | ||
END'); | ||
DB::connection(config('laravel-scheduler-watcher.mysql_connection'))->unprepared(' | ||
CREATE | ||
TRIGGER tr_bi_job_event_outputs | ||
BEFORE INSERT | ||
ON job_event_outputs | ||
FOR EACH ROW | ||
BEGIN | ||
SET NEW.jobo_db_created = NOW(); | ||
END'); | ||
} | ||
|
||
|
||
public function down(): void | ||
{ | ||
DB::connection(config('laravel-scheduler-watcher.mysql_connection'))->unprepared('DROP TRIGGER tr_bi_jobs'); | ||
DB::connection(config('laravel-scheduler-watcher.mysql_connection'))->unprepared('DROP TRIGGER tr_bi_job_events'); | ||
DB::connection(config('laravel-scheduler-watcher.mysql_connection'))->unprepared('DROP TRIGGER tr_bu_job_events'); | ||
DB::connection(config('laravel-scheduler-watcher.mysql_connection'))->unprepared('DROP TRIGGER tr_bi_job_event_outputs'); | ||
} | ||
|
||
}; |