首頁  >  文章  >  後端開發  >  mysql中的timestamps欄位不起作用

mysql中的timestamps欄位不起作用

WBOY
WBOY原創
2016-12-01 00:00:391149瀏覽

為什麼我設定了某個欄位類型為timestamps,但是他並沒有像我預期的一樣在更新或新增的時候自動填入當前時間戳記?

還有我用Laravel的migrate產生的資料表也一樣,產生的表裡面那個timestamps欄位根本不起效果。是怎麼回事?

這是migration檔

<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>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn