I have a table migrated with php artisan
. It has timestamps:
$table->timestamps();
When I seed his table with MYSQL: it's fine. However when I do that with Postgres, I get this error:
ERROR: null value in column "updated_at" violates not-null constraint
DETAIL: Failing row contains
Is this because I have indexing for my timestamps?
$table->index('created_at');
$table->index('updated_at');
What can I do? Not use updated_at
indexing? Define the timestamps as ->nullable();
?
The error you get makes the solution pretty obvious: make the column
nullable
. You can use the dedicatednullableTimestamps
method to make it easier: