2019_06_03_162324_create_table_post.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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视频,text图文');
  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->integer('city_id')
  47. ->default(0)
  48. ->comment('城市id');
  49. $table->string('city_name', 16)
  50. ->default('')
  51. ->comment('城市名称');
  52. $table->tinyInteger('is_suggest')
  53. ->default(0)
  54. ->comment('是否推荐:0否,1是');
  55. $table->tinyInteger('is_hide')
  56. ->default(0)
  57. ->comment('是否隐藏:0否,1是');
  58. $table->softDeletes();
  59. $table->timestamps();
  60. });
  61. }
  62. /**
  63. * Reverse the migrations.
  64. *
  65. * @return void
  66. */
  67. public function down()
  68. {
  69. Schema::dropIfExists('post');
  70. }
  71. }