You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.2 KiB

  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m191111_102644_create_table_province
  5. */
  6. class m191204_102644_create_table_province extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function up()
  12. {
  13. $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="用户"';
  14. $this->createTable('user', [
  15. 'id' => $this->primaryKey(),
  16. 'username'=>$this->string(255)->comment('用户名'),
  17. 'auth_key'=>$this->string(32)->notNull()->comment(''),
  18. 'password_hash'=>$this->string(255)->notNull()->comment(''),
  19. 'password_reset_token'=>$this->string(255)->defaultValue(null)->comment(''),
  20. 'name'=>$this->string(120)->comment('姓名'),
  21. 'sex'=>$this->integer(1)->comment('性别'),
  22. 'phone'=>$this->string(13)->comment('联系方式'),
  23. 'email'=>$this->string(255)->comment('邮箱'),
  24. 'role'=>$this->tinyInteger(1)->defaultValue(1)->comment('角色'),
  25. 'status'=>$this->tinyInteger(1)->defaultValue(1)->comment('状态'),
  26. 'access_token'=>$this->string(255)->comment('令牌'),
  27. 'expire_at'=>$this->integer(11)->comment('令牌过期时间'),
  28. 'nickname'=>$this->string(120)->comment('昵称'),
  29. 'avatar'=>$this->string(255)->comment('头像'),
  30. 'wx_openid'=>$this->string(32)->comment('微信openid'),
  31. 'mini_openid'=>$this->string(32)->comment('小程序openid'),
  32. 'unionid'=>$this->string(60)->comment('微信联合id'),
  33. 'session_key'=>$this->string(120)->comment('小程序会话秘钥'),
  34. 'member_code'=>$this->string(20)->comment('会员编号'),
  35. 'exp_point'=>$this->integer(20)->comment('经验值'),
  36. 'consume_point'=>$this->integer(20)->defaultValue(null)->comment('消费积分'),
  37. 'created_at'=>$this->integer(11)->notNull()->comment('创建时间'),
  38. 'updated_at'=>$this->integer(11)->notNull()->comment('更新时间'),
  39. ],$tableOptions);
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function down()
  45. {
  46. $this->dropTable("user");
  47. return true;
  48. }
  49. }