为了账号安全,请及时绑定邮箱和手机立即绑定

think-migration 创建表失败

think-migration 创建表失败

PHP
梦里花落0921 2019-02-02 16:05:56
问题描述按照这个入门实战敲的代码 https://www.kancloud.cn/inbuf...做到第6章验证那里的时候发现不管是否验证正确,都是报错数据库表不存在。当时还不确认一定是数据库表没建立成功,怕也有其他原因导致,然后我就从验证那个章节往前面查找原因,最后发现就是在第5章第2节那里数据迁移发生了问题。应该是在这里创建表的时候就失败了。 // create the table         $table = $this->table('users');         $table->addColumn('name', 'string')             ->addColumn('email', 'string')             ->addColumn('password', 'string')             ->addColumn('avatar', 'string', ['null' => true, 'default'=>NULL, 'comment'=>'用户头像'])             ->addColumn('god', 'boolean', ['default'=>FALSE, 'comment'=>'管理员'])             ->addTimestamps('created_at', 'updated_at')             ->addIndex('email', ['unique' => true])             ->addIndex('god')             ->create();我的代码也是有这些,所以不知道为什么表没有创建成功。
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1112 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信