2022_06_16_091424_create_purchases_table.php 851B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration {
  6. /**
  7. * Run the migrations.
  8. *
  9. * @return void
  10. */
  11. public function up()
  12. {
  13. Schema::create("purchases", function (Blueprint $table) {
  14. $table->id();
  15. $table->string("number")->unique();
  16. $table->unsignedTinyInteger("ppn");
  17. $table->enum("status", ["pending", "success"]);
  18. $table->foreignId("supplier_id")->constrained();
  19. $table->foreignId("user_id")->constrained();
  20. $table->timestamps();
  21. });
  22. }
  23. /**
  24. * Reverse the migrations.
  25. *
  26. * @return void
  27. */
  28. public function down()
  29. {
  30. Schema::dropIfExists("purchases");
  31. }
  32. };