LMSouq
php-dev Open

How Can I Set the Default Value of a Timestamp Column to the Current Timestamp with Laravel Migrations?

JO
JoeyD473
1 month ago
3 views
Problem Description
I would like to make a timestamp column with a default value of `CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP` using the Laravel Schema Builder/Migrations. I have gone through the Laravel documentation several times, and I don't see how I can make that the default for a timestamp column. The `timestamps()` function makes the defaults `0000-00-00 00:00` for both columns that it makes.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base