Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <?php
  2.  
  3. use Illuminate\Support\Facades\Schema;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Database\Migrations\Migration;
  6.  
  7. class CreateCartsTable extends Migration
  8. {
  9. /**
  10. * Run the migrations.
  11. *
  12. * @return void
  13. */
  14. public function up()
  15. {
  16. Schema::create('carts', function (Blueprint $table) {
  17. $table->bigIncrements('id');
  18.  
  19. $table->unsignedBigInteger('user_id')->nullable();
  20. $table->string('session_id')->nullable();
  21. $table->string('user_agent');
  22.  
  23. $table->softDeletes();
  24. $table->timestamps();
  25.  
  26. $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
  27. });
  28. }
  29.  
  30. /**
  31. * Reverse the migrations.
  32. *
  33. * @return void
  34. */
  35. public function down()
  36. {
  37. Schema::dropIfExists('carts');
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement