2020_07_17_125110_create_users_table.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateUsersTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('users', function (Blueprint $table) {
  15. $table->id();
  16. $table->string('wx_openid')->nullable()->comment('微信用户openid')->unique();
  17. $table->string('wx_nickname')->nullable()->comment('用户昵称');
  18. $table->integer('wx_sex')->default(0)->comment('性别 1:男性,2:女性,0:未知')->index();
  19. $table->string('wx_province')->nullable()->comment('省份');
  20. $table->string('wx_city')->nullable()->comment('城市');
  21. $table->string('wx_country')->nullable()->comment('国家');
  22. $table->string('wx_headimgurl')->nullable()->comment('用户头像');
  23. $table->timestamps();
  24. $table->softDeletes();
  25. });
  26. }
  27. /**
  28. * Reverse the migrations.
  29. *
  30. * @return void
  31. */
  32. public function down()
  33. {
  34. Schema::dropIfExists('users');
  35. }
  36. }