2015_12_14_144438_create_comments_table.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateCommentsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('comments', function (Blueprint $table) {
  15. $table->increments('id')->unsigned();
  16. $table->integer('user_id')->unsigned()->index(); //评论人
  17. $table->text('content');
  18. $table->morphs('source');
  19. $table->integer('to_user_id')->unsigned()->nullable();
  20. $table->tinyInteger('status')->default(1);
  21. $table->tinyInteger('device')->default(1)->comment("设备类型:1web版本,2小程序"); //提问设备类型1pc,2安卓,3IOS,4weixin
  22. $table->timestamps();
  23. });
  24. }
  25. /**
  26. * Reverse the migrations.
  27. *
  28. * @return void
  29. */
  30. public function down()
  31. {
  32. Schema::drop('comments');
  33. }
  34. }