1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- return new class extends Migration {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('spec', function (Blueprint $table) {
- $table->id();
- $table->string("name")->default("");
- $table->string("extra", 2000)->default("");
- $table->unsignedInteger("index_weight")->default(0);
- $table->unsignedInteger("category_weight")->default(0);
- $table->unsignedInteger("search_weight")->default(0);
- $table->unsignedTinyInteger("is_custom")->default(0)->comment("是否自定义");
- $table->timestamps();
- $table->softDeletes();
- });
- Schema::create("spec_attr", function (Blueprint $t) {
- $t->id();
- $t->unsignedInteger("spec_id");
- $t->string("name");
- $t->timestamps();
- $t->softDeletes();
- });
- Schema::create('category', function (Blueprint $table) {
- $table->id();
- $table->string("name")->default("");
- $table->string("thumb")->default("");
- $table->unsignedTinyInteger("level")->default(0)->comment("层级");
- $table->unsignedInteger("parent_id")->default(0)->comment("上级分类ID");
- $table->integer("weight")->default(0)->comment("权重");
- $table->integer("index_weight")->default(0)->comment("推荐位权重");
- $table->integer("category_weight")->default(0)->comment("推荐位权重");
- $table->integer("search_weight")->default(0)->comment("搜索页权重");
- $table->timestamps();
- $table->softDeletes();
- });
- Schema::create('goods', function (Blueprint $table) {
- $table->id();
- $table->string("name")->default("");
- $table->string("image_list", 2000)->default("");
- $table->string("spec")->default("")->comment("商品的规格");
- $table->unsignedInteger("weight")->default(0);
- $table->text("desc_html")->nullable();
- $table->text("spec_attr_html")->nullable();
- $table->text("faq_html")->nullable();
- $table->timestamps();
- $table->softDeletes();
- });
- Schema::create('goods_category_map', function (Blueprint $table) {
- $table->id();
- $table->unsignedInteger("goods_id")->default(0);
- $table->unsignedInteger("category_id")->default(0);
- $table->unsignedTinyInteger("is_public")->default(1)->comment("是否对普通会员展示");
- $table->timestamps();
- });
- Schema::create('goods_sku', function (Blueprint $table) {
- $table->id();
- $table->unsignedInteger("goods_id")->default(0);
- $table->string("sn")->default("")->comment("型号");
- $table->string("3d_url")->default("")->comment("3D的跳转地址");
- $table->string("spec_attr_list", 2000)->default("")->comment("规格数据");
- $table->unsignedTinyInteger("is_use")->default(1)->comment("是否使用");
- $table->timestamps();
- $table->softDeletes();
- $table->index("goods_id");
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('spec');
- Schema::dropIfExists('spec_attr');
- Schema::dropIfExists('category');
- Schema::dropIfExists('goods');
- Schema::dropIfExists('goods_category_map');
- Schema::dropIfExists('goods_sku');
- }
- };
|