2019_07_29_095032_create_table_feeds.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateTableFeeds extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. for($i = 0; $i < 10; $i++){
  15. Schema::create('feed_'.$i, function (Blueprint $table) {
  16. $table->bigIncrements('id');
  17. $table->integer('uid')
  18. ->index('uid')
  19. ->comment('uid');
  20. $table->integer('follow_uid')
  21. ->comment('关注人uid');
  22. $table->string('follow_username')
  23. ->default('')
  24. ->comment('关注人昵称');
  25. $table->string('follow_avatar')
  26. ->default('')
  27. ->comment('关注人头像');
  28. $table->string('type', 32)
  29. ->default('post_create')
  30. ->comment('类型');
  31. $table->integer('relate_id')
  32. ->default(0)
  33. ->comment('相关id');
  34. $table->string('content', 1000)
  35. ->default('')
  36. ->comment('内容');
  37. $table->timestamps();
  38. });
  39. }
  40. }
  41. /**
  42. * Reverse the migrations.
  43. *
  44. * @return void
  45. */
  46. public function down()
  47. {
  48. Schema::dropIfExists('feed');
  49. }
  50. }