2020_08_21_145711_create_goods_table.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateGoodsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('goods', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->string('name', 100)->comment('商品名称');
  17. $table->string('logo')->nullable()->comment('商品图片地址');
  18. $table->unsignedBigInteger('traffic')->default(0)->comment('商品内含多少流量,单位MiB');
  19. $table->boolean('type')->default(1)->comment('商品类型:1-流量包、2-套餐');
  20. $table->unsignedInteger('price')->default(0)->comment('售价,单位分');
  21. $table->unsignedTinyInteger('level')->default(0)->comment('购买后给用户授权的等级');
  22. $table->unsignedInteger('renew')->nullable()->comment('流量重置价格,单位分');
  23. $table->unsignedInteger('period')->nullable()->comment('流量自动重置周期');
  24. $table->string('info')->nullable()->comment('商品信息');
  25. $table->string('description')->nullable()->comment('商品描述');
  26. $table->unsignedInteger('days')->default(30)->comment('有效期');
  27. $table->unsignedInteger('invite_num')->nullable()->comment('赠送邀请码数');
  28. $table->unsignedInteger('limit_num')->nullable()->comment('限购数量,默认为null不限购');
  29. $table->string('color', 50)->default('green')->comment('商品颜色');
  30. $table->unsignedTinyInteger('sort')->default(0)->comment('排序');
  31. $table->boolean('is_hot')->default(0)->comment('是否热销:0-否、1-是');
  32. $table->boolean('status')->default(0)->comment('状态:0-下架、1-上架');
  33. $table->dateTime('created_at')->comment('创建时间');
  34. $table->dateTime('updated_at')->comment('最后更新时间');
  35. $table->softDeletes()->comment('删除时间');
  36. });
  37. }
  38. /**
  39. * Reverse the migrations.
  40. *
  41. * @return void
  42. */
  43. public function down()
  44. {
  45. Schema::dropIfExists('goods');
  46. }
  47. }