Home > Article > Backend Development > timestamps field in mysql not working
Why did I set a field type to timestamps, but it did not automatically fill in the current timestamp when updating or adding as I expected?
The same goes for the data table I generated using Laravel's migrate. The timestamps field in the generated table has no effect at all. what's going on?
This is the migration file
<code><?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateEquip extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('equip', function (Blueprint $table) { // $table->increments('id'); $table->smallInteger('equip_id')->unsigned()->comment('装备id'); $table->string('eqiup_name')->comment('装备名称'); $table->string('eqiup_desc')->comment('装备描述'); $table->timestamps(); $table->primary('equip_id'); }); } /** * Reverse the migrations. * * @return void */ public function down() { // } } </code>