I have a migration that has the timestamps()
method, and then I have a seed to seed this table.
Schema::create('mytable', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->timestamps();
});
The seed looks like this:
DB::table('mytable')->insert([
[
'title' => 'My Awesome Title'
]
]);
When it all gets run using:
php artisan migrate:refresh --seed
The item gets inserted, but the values of created_at
and updated_at
are both 0000-00-00 00:00:00
why are they not set correctly?
here are the column schemes that it creates:
`created_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
I would like these schemes:
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,