Replies: 1 comment 1 reply
-
|
Laravel itself doesn’t have built-in support for defining triggers via migrations, but there are a few good ways to implement them cleanly while still keeping your migrations portable and version-controlled. use Illuminate\Database\Migrations\Migration; return new class extends Migration { }; example packages : |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently working on a little project and noticed that there doesn't seem to be an option to create custom database triggers. If I am looking in the wrong place, please let me know, but I think this would be a great feature because it offloads some of the work the framework would need to do to the database server/application.
Common use cases I have for database triggers are:
For SQL Server you would create a trigger like so to automatically set the
updated_atdatetime:For Postgres it's a bit more convoluted, but you would do something like the following:
Beta Was this translation helpful? Give feedback.
All reactions