2020_08_21_145711_create_user_subscribe_table.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateUserSubscribeTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('user_subscribe', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
  17. $table->char('code', 8)->index()->comment('订阅地址唯一识别码');
  18. $table->unsignedInteger('times')->default(0)->comment('地址请求次数');
  19. $table->boolean('status')->default(1)->comment('状态:0-禁用、1-启用');
  20. $table->unsignedInteger('ban_time')->nullable()->comment('封禁时间');
  21. $table->string('ban_desc', 50)->nullable()->comment('封禁理由');
  22. $table->dateTime('created_at')->comment('创建时间');
  23. $table->dateTime('updated_at')->comment('最后更新时间');
  24. $table->index(['user_id', 'status'], 'user_id');
  25. });
  26. }
  27. /**
  28. * Reverse the migrations.
  29. *
  30. * @return void
  31. */
  32. public function down()
  33. {
  34. Schema::dropIfExists('user_subscribe');
  35. }
  36. }