2023_05_10_073046_create_usersomething_table.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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('user_fav', function (Blueprint $table) {
  14. $table->id();
  15. $table->unsignedInteger("user_id")->default(0);
  16. $table->unsignedInteger("goods_id")->default(0);
  17. $table->timestamps();
  18. $table->softDeletes();
  19. });
  20. Schema::create('user_address', function (Blueprint $table) {
  21. $table->id();
  22. $table->unsignedInteger("user_id")->default(0);
  23. $table->string("name")->default('');
  24. $table->string("phone")->default('');
  25. $table->string("area")->default('');
  26. $table->string("address")->default("");
  27. $table->tinyInteger("is_default")->default(0);
  28. $table->timestamps();
  29. });
  30. }
  31. /**
  32. * Reverse the migrations.
  33. *
  34. * @return void
  35. */
  36. public function down()
  37. {
  38. Schema::dropIfExists('user_fav');
  39. Schema::dropIfExists('user_address');
  40. }
  41. };