2020_08_21_145711_create_user_table.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateUserTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('user', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->string('username', 64)->comment('昵称');
  17. $table->string('email', 128)->unique()->comment('邮箱');
  18. $table->string('password', 64)->comment('密码');
  19. $table->unsignedSmallInteger('port')->default(0)->comment('代理端口');
  20. $table->string('passwd', 16)->comment('代理密码');
  21. $table->uuid('vmess_id');
  22. $table->unsignedBigInteger('transfer_enable')->default(1099511627776)->comment('可用流量,单位字节,默认1TiB');
  23. $table->unsignedBigInteger('u')->default(0)->comment('已上传流量,单位字节');
  24. $table->unsignedBigInteger('d')->default(0)->comment('已下载流量,单位字节');
  25. $table->unsignedInteger('t')->nullable()->comment('最后使用时间');
  26. $table->ipAddress('ip')->nullable()->comment('最后连接IP');
  27. $table->boolean('enable')->default(1)->comment('代理状态');
  28. $table->string('method', 30)->default('aes-256-cfb')->comment('加密方式');
  29. $table->string('protocol', 30)->default('origin')->comment('协议');
  30. $table->string('protocol_param')->nullable()->comment('协议参数');
  31. $table->string('obfs', 30)->default('plain')->comment('混淆');
  32. $table->unsignedBigInteger('speed_limit')->default(0)->comment('用户限速,为0表示不限速,单位Byte');
  33. $table->string('wechat', 30)->nullable()->comment('微信');
  34. $table->string('qq', 20)->nullable()->comment('QQ');
  35. $table->unsignedInteger('credit')->default(0)->comment('余额,单位分');
  36. $table->date('expired_at')->default('2099-01-01')->comment('过期时间');
  37. $table->unsignedInteger('ban_time')->nullable()->comment('封禁到期时间');
  38. $table->text('remark')->nullable()->comment('备注');
  39. $table->unsignedTinyInteger('level')->default(0)->comment('等级,默认0级');
  40. $table->unsignedInteger('group_id')->default(0)->comment('所属分组');
  41. $table->boolean('is_admin')->default(0)->comment('是否管理员:0-否、1-是');
  42. $table->ipAddress('reg_ip')->default('127.0.0.1')->comment('注册IP');
  43. $table->unsignedInteger('last_login')->default(0)->comment('最后登录时间');
  44. $table->unsignedInteger('inviter_id')->nullable()->comment('邀请人');
  45. $table->date('reset_time')->nullable()->comment('流量重置日期');
  46. $table->unsignedInteger('invite_num')->default(0)->comment('可生成邀请码数');
  47. $table->boolean('status')->default(0)->comment('状态:-1-禁用、0-未激活、1-正常');
  48. $table->string('remember_token')->nullable();
  49. $table->dateTime('created_at')->comment('创建时间');
  50. $table->dateTime('updated_at')->comment('最后更新时间');
  51. $table->index(['enable', 'status', 'port'], 'idx_search');
  52. });
  53. }
  54. /**
  55. * Reverse the migrations.
  56. *
  57. * @return void
  58. */
  59. public function down()
  60. {
  61. Schema::dropIfExists('user');
  62. }
  63. }