Laravel 框架版本 5.2.5
当我更新一条记录时,update_at 没有更改,但 created_at 更改为当前时间戳。
这个对吗?
MariaDB [月亮]> 显示来自用户的列; +----------------+------------------+------+------+ ---------------------+---------------------------- -+ | 领域 | 类型 | 空 | 钥匙 | 默认 | 额外 | +----------------+------------------+------+------+ ---------------------+---------------------------- -+ | 编号 | int(10) 无符号 | 否 | 优先级 | 空 | 自动增量 | | 姓名 | varchar(255) | 否 | | 空 | | | 电子邮件 | varchar(255) | 否 | 统一 | 空 | | | 密码 | varchar(60) | 否 | | 空 | | | 记住令牌 | varchar(100) | 是 | | 空 | | | created_at | 时间戳 | 否 | | CURRENT_TIMESTAMP | 在更新 CURRENT_TIMESTAMP | | 更新时间 | 时间戳 | 否 | | 0000-00-00 00:00:00 | | +----------------+------------------+------+------+ ---------------------+---------------------------- -+
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}