2020_10_16_105234_create_posts_table.php 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. use Illuminate\Database\Migrations\Migration;
  11. use Illuminate\Database\Schema\Blueprint;
  12. use Illuminate\Support\Facades\Schema;
  13. /**
  14. * Class CreatePostsTable.
  15. */
  16. class CreatePostsTable extends Migration
  17. {
  18. /**
  19. * Run the migrations.
  20. *
  21. * @return void
  22. */
  23. public function up()
  24. {
  25. Schema::create('posts', function (Blueprint $table) {
  26. $table->bigIncrements('id');
  27. $table->unsignedBigInteger('user_id');
  28. $table->text('title');
  29. $table->text('body');
  30. $table->boolean('published');
  31. $table->timestamps();
  32. });
  33. }
  34. /**
  35. * Reverse the migrations.
  36. *
  37. * @return void
  38. */
  39. public function down()
  40. {
  41. Schema::drop('posts');
  42. }
  43. }