2019_06_03_162324_create_table_post.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateTablePost extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('post', function (Blueprint $table) {
  15. $table->bigIncrements('id');
  16. $table->integer('uid')
  17. ->index('uid')
  18. ->unsigned()
  19. ->comment('uid');
  20. $table->string('username', 32)
  21. ->default('')
  22. ->comment('昵称');
  23. $table->string('mobile', 16)
  24. ->default('')
  25. ->comment('电话');
  26. $table->string('avatar', 255)
  27. ->default('')
  28. ->comment('头像');
  29. $table->string('type', 16)
  30. ->default('image')
  31. ->comment('类型:image图文,video视频,html富文本');
  32. $table->string('img', 255)
  33. ->comment('主图');
  34. $table->string('video', 255)
  35. ->default('')
  36. ->comment('视频');
  37. $table->string('topic_ids', 64)
  38. ->default('')
  39. ->comment('话题ids');
  40. $table->string('title', 64)
  41. ->default('')
  42. ->comment('标题');
  43. $table->text('content')
  44. ->nullable()
  45. ->comment('内容');
  46. $table->string('location', 32)
  47. ->default('')
  48. ->comment('定位');
  49. $table->tinyInteger('is_suggest')
  50. ->default(0)
  51. ->comment('是否推荐:0否,1是');
  52. $table->tinyInteger('is_hide')
  53. ->default(0)
  54. ->comment('是否隐藏:0否,1是');
  55. $table->softDeletes();
  56. $table->timestamps();
  57. });
  58. }
  59. /**
  60. * Reverse the migrations.
  61. *
  62. * @return void
  63. */
  64. public function down()
  65. {
  66. Schema::dropIfExists('post');
  67. }
  68. }