1.使用laragon新建laravel项目 zhihu

2.配置env文件的database设置 DB_DATABASE=zhihu

3.分析users表需要的字段

4.修改数据库迁移文件:

  1 class CreateUsersTable extends Migration
2 {
3 /**
4 * Run the migrations.
5 *
6 * @return void
7 */
8 public function up()
9 {
10 Schema::create('users', function (Blueprint $table) {
11 $table->bigIncrements('id');
12 $table->string('name')->unique();
13 $table->string('email')->unique();
14 $table->timestamp('email_verified_at')->nullable();
15 $table->string('password');
16 $table->string('activation_token', 40);
17 $table->smallInteger('activated')->default(0);
18 $table->string('avatar');
19 $table->integer('questions_count')->default(0);
20 $table->integer('answers_count')->default(0);
21 $table->integer('comments_count')->default(0);
22 $table->integer('favorites_count')->default(0);
23 $table->integer('likes_count')->default(0);
24 $table->integer('followers_count')->default(0);
25 $table->integer('followings_count')->default(0);
26 $table->json('settings')->nullable();
27 $table->rememberToken();
28 $table->timestamps();
29 });
30 }
31
32 /**
33 * Reverse the migrations.
34 *
35 * @return void
36 */
37 public function down()
38 {
39 Schema::dropIfExists('users');
40 }
41 }

5.执行

  1 php artisan migrate

最新文章

  1. PL/SQL使用技巧
  2. log level
  3. 参数嗅探(Parameter Sniffing)(1/2)
  4. 欧拉路径Hrbust1351
  5. 【 D3.js 高级系列 — 10.0 】 思维导图
  6. DB2存储过程实现查询表数据,生成动态SQL,并执行
  7. SqlServer 允许保存对数据库中表结构的修改
  8. C#制作ActiveX控件及部署升级(摘自网络)
  9. 博客终于开通了happy
  10. javascript基础(三)运算
  11. Eclipse/MyEclipse中使用复制粘贴功能卡的解决办法
  12. loadrunner入门篇-Controller控制器
  13. 转:【Java并发编程】之一:可重入内置锁
  14. 201521123117 《Java程序设计》第9周学习总结
  15. 使用测试思路快速学习Python-适合测试工程师的学习方法
  16. 理解 Linux 的硬链接与软链接
  17. Ubuntu18.4中Apache在加不同端口的虚拟主机
  18. ZZNU 正约数之和
  19. Python 读取数据
  20. MongoDB的基本shell操作(三)

热门文章

  1. fileupload插件调用upload.parseRequest(request)解析得到空值问题
  2. 使用maven 打包springboot项目步骤以及所遇到的问题
  3. (转)JSONObject的toBean 和 fromObject
  4. 利用数据库管理工具(Navicat)导出数据到Excel表中
  5. A. DZY Loves Chessboard
  6. BT详解,BT原理
  7. cordova的安装与配置
  8. Error: Cannot find module 'webpack' 问题解决办法
  9. docker-compose介绍及部署LNMP
  10. boolean类型set、get方法