2023_04_28_071852_create_goods_table.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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('spec', function (Blueprint $table) {
  14. $table->id();
  15. $table->string("name")->default("");
  16. $table->string("extra", 2000)->default("");
  17. $table->unsignedInteger("index_weight")->default(0);
  18. $table->unsignedInteger("category_weight")->default(0);
  19. $table->unsignedInteger("search_weight")->default(0);
  20. $table->unsignedTinyInteger("is_custom")->default(0)->comment("是否自定义");
  21. $table->timestamps();
  22. $table->softDeletes();
  23. });
  24. Schema::create("spec_attr", function (Blueprint $t) {
  25. $t->id();
  26. $t->unsignedInteger("spec_id");
  27. $t->string("name");
  28. $t->timestamps();
  29. $t->softDeletes();
  30. });
  31. }
  32. /**
  33. * Reverse the migrations.
  34. *
  35. * @return void
  36. */
  37. public function down()
  38. {
  39. Schema::dropIfExists('spec');
  40. Schema::dropIfExists('spec_attr');
  41. }
  42. };