1.配置好数据库

DB_HOST=localhost
DB_DATABASE=laravel5
DB_USERNAME=root
DB_PASSWORD=password

保证数据库连接正常,然后查看建表脚本是否准备好
这里写图片描述
2.执行数据迁移命令

php artisan migrate

3.去数据库看看三张表已经出来了。

补充
如果需要建表语句添加字段注释使用

->comment()
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->comment('用户名');
            $table->string('email')->unique()->comment('用户邮箱');
            $table->string('password', 60);
            $table->rememberToken();
            $table->timestamps();
        });
    }

标签: Laravel

添加新评论


手机号仅后台超管可见,普通注册用户以及网站前台全站不可见,请勿担心泄露风险!