添加索引
This commit is contained in:
parent
cadc91d2da
commit
3f81dec2eb
|
|
@ -16,13 +16,13 @@ class CreateTables extends Migration
|
|||
Schema::create('addresses', function (Blueprint $table) {
|
||||
$table->comment('用户地址表');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedInteger('customer_id')->comment('客户 ID');
|
||||
$table->unsignedInteger('customer_id')->comment('客户 ID')->index('customer_id');
|
||||
$table->string('name')->comment('姓名');
|
||||
$table->string('phone')->comment('电话');
|
||||
$table->unsignedInteger('country_id')->comment('国家 ID');
|
||||
$table->unsignedInteger('zone_id')->comment('省份 ID');
|
||||
$table->unsignedInteger('country_id')->comment('国家 ID')->index('country_id');
|
||||
$table->unsignedInteger('zone_id')->comment('省份 ID')->index('zone_id');
|
||||
$table->string('zone')->comment('省份名称');
|
||||
$table->unsignedInteger('city_id')->nullable()->comment('城市 ID');
|
||||
$table->unsignedInteger('city_id')->nullable()->comment('城市 ID')->index('city_id');
|
||||
$table->string('city')->comment('城市名称');
|
||||
$table->string('zipcode')->comment('邮编');
|
||||
$table->string('address_1')->comment('地址1');
|
||||
|
|
@ -58,20 +58,20 @@ class CreateTables extends Migration
|
|||
Schema::create('carts', function (Blueprint $table) {
|
||||
$table->comment('购物车');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('customer_id')->comment('客户 ID');
|
||||
$table->integer('shipping_address_id')->comment('配送地址 ID');
|
||||
$table->integer('customer_id')->comment('客户 ID')->index('customer_id');
|
||||
$table->integer('shipping_address_id')->comment('配送地址 ID')->index('shipping_address_id');
|
||||
$table->string('shipping_method_code')->comment('配送方式 Code');
|
||||
$table->integer('payment_address_id')->comment('发票地址 ID');
|
||||
$table->integer('payment_address_id')->comment('发票地址 ID')->index('payment_address_id');
|
||||
$table->string('payment_method_code')->comment('支付方式 Code');
|
||||
$table->timestamps();
|
||||
});
|
||||
Schema::create('cart_products', function (Blueprint $table) {
|
||||
$table->comment('购物车产品明细');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('customer_id')->comment('客户 ID');
|
||||
$table->integer('customer_id')->comment('客户 ID')->index('customer_id');
|
||||
$table->boolean('selected')->comment('是否选中');
|
||||
$table->integer('product_id')->comment('产品 ID');
|
||||
$table->integer('product_sku_id')->comment('产品 SKU ID');
|
||||
$table->integer('product_id')->comment('产品 ID')->index('product_id');
|
||||
$table->integer('product_sku_id')->comment('产品 SKU ID')->index('product_sku_id');
|
||||
$table->unsignedInteger('quantity')->comment('购买数量');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
@ -80,7 +80,7 @@ class CreateTables extends Migration
|
|||
Schema::create('categories', function (Blueprint $table) {
|
||||
$table->comment('产品分类');
|
||||
$table->id()->startingValue(100_000)->comment('ID');
|
||||
$table->unsignedBigInteger('parent_id')->default(0)->comment('父级分类ID');
|
||||
$table->unsignedBigInteger('parent_id')->default(0)->comment('父级分类ID')->index('parent_id');
|
||||
$table->integer('position')->default(0)->comment('排序');
|
||||
$table->boolean('active')->comment('是否启用');
|
||||
$table->timestamps();
|
||||
|
|
@ -88,7 +88,7 @@ class CreateTables extends Migration
|
|||
Schema::create('category_descriptions', function (Blueprint $table) {
|
||||
$table->comment('产品分类名称、描述等详情');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedBigInteger('category_id')->comment('分类 ID');
|
||||
$table->unsignedBigInteger('category_id')->comment('分类 ID')->index('category_id');
|
||||
$table->string('locale')->comment('语言');
|
||||
$table->string('name')->comment('名称');
|
||||
$table->text('content')->comment('描述');
|
||||
|
|
@ -100,8 +100,8 @@ class CreateTables extends Migration
|
|||
Schema::create('category_paths', function (Blueprint $table) {
|
||||
$table->comment('产品分类上下级关系');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedBigInteger('category_id')->comment('分类 ID');
|
||||
$table->unsignedBigInteger('path_id')->comment('分类路径 ID');
|
||||
$table->unsignedBigInteger('category_id')->comment('分类 ID')->index('customer_id');
|
||||
$table->unsignedBigInteger('path_id')->comment('分类路径 ID')->index('path_id');
|
||||
$table->integer('level')->comment('层级');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
@ -139,8 +139,8 @@ class CreateTables extends Migration
|
|||
$table->string('password')->comment('密码');
|
||||
$table->string('name')->comment('用户名');
|
||||
$table->string('avatar')->default('')->comment('头像');
|
||||
$table->unsignedInteger('customer_group_id')->comment('用户组 ID');
|
||||
$table->unsignedInteger('address_id')->default(0)->comment('默认地址 ID');
|
||||
$table->unsignedInteger('customer_group_id')->comment('用户组 ID')->index('customer_group_id');
|
||||
$table->unsignedInteger('address_id')->default(0)->comment('默认地址 ID')->index('address_id');
|
||||
$table->string('locale', 10)->comment('语言');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态');
|
||||
$table->string('code', 40)->default('')->comment('找回密码 code');
|
||||
|
|
@ -161,7 +161,7 @@ class CreateTables extends Migration
|
|||
Schema::create('customer_group_descriptions', function (Blueprint $table) {
|
||||
$table->comment('客户组名称、描述');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedInteger('customer_group_id')->comment('客户组 ID');
|
||||
$table->unsignedInteger('customer_group_id')->comment('客户组 ID')->index('customer_group_id');
|
||||
$table->string('locale', 10)->comment('语言');
|
||||
$table->string('name', 256)->comment('名称');
|
||||
$table->text('description')->comment('描述');
|
||||
|
|
@ -170,8 +170,8 @@ class CreateTables extends Migration
|
|||
Schema::create('customer_wishlists', function (Blueprint $table) {
|
||||
$table->comment('客户收藏夹');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedInteger('customer_id')->comment('客户 ID');
|
||||
$table->unsignedInteger('product_id')->comment('产品 ID');
|
||||
$table->unsignedInteger('customer_id')->comment('客户 ID')->index('customer_id');
|
||||
$table->unsignedInteger('product_id')->comment('产品 ID')->index('product_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
|
@ -193,10 +193,10 @@ class CreateTables extends Migration
|
|||
$table->comment('订单');
|
||||
$table->id()->comment('ID');
|
||||
$table->string('number')->comment('订单号');
|
||||
$table->integer('customer_id')->comment('客户 ID');
|
||||
$table->integer('customer_group_id')->comment('客户组 ID');
|
||||
$table->integer('shipping_address_id')->comment('配送地址 ID');
|
||||
$table->integer('payment_address_id')->comment('发票地址 ID');
|
||||
$table->integer('customer_id')->comment('客户 ID')->index('customer_id');
|
||||
$table->integer('customer_group_id')->comment('客户组 ID')->index('customer_group_id');
|
||||
$table->integer('shipping_address_id')->comment('配送地址 ID')->index('shipping_address_id');
|
||||
$table->integer('payment_address_id')->comment('发票地址 ID')->index('payment_address_id');
|
||||
$table->string('customer_name')->comment('客户名称');
|
||||
$table->string('email')->comment('客户 Email');
|
||||
$table->integer('calling_code')->comment('电话区号');
|
||||
|
|
@ -234,8 +234,8 @@ class CreateTables extends Migration
|
|||
Schema::create('order_products', function (Blueprint $table) {
|
||||
$table->comment('订单产品明细');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('order_id')->comment('订单 ID');
|
||||
$table->integer('product_id')->comment('产品 ID');
|
||||
$table->integer('order_id')->comment('订单 ID')->index('order_id');
|
||||
$table->integer('product_id')->comment('产品 ID')->index('product_id');
|
||||
$table->string('order_number')->comment('订单号');
|
||||
$table->string('product_sku')->comment('产品 SKU');
|
||||
$table->string('name')->comment('产品名称');
|
||||
|
|
@ -248,7 +248,7 @@ class CreateTables extends Migration
|
|||
Schema::create('order_histories', function (Blueprint $table) {
|
||||
$table->comment('订单状态变更历史');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('order_id')->comment('订单 ID');
|
||||
$table->integer('order_id')->comment('订单 ID')->index('order_id');
|
||||
$table->string('status')->comment('订单变更状态');
|
||||
$table->boolean('notify')->comment('是否通知');
|
||||
$table->text('comment')->comment('变更备注');
|
||||
|
|
@ -257,7 +257,7 @@ class CreateTables extends Migration
|
|||
Schema::create('order_totals', function (Blueprint $table) {
|
||||
$table->comment('订单金额构成');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('order_id')->comment('订单 ID');
|
||||
$table->integer('order_id')->comment('订单 ID')->index('order_id');
|
||||
$table->string('code')->comment('类型编码');
|
||||
$table->decimal('value')->comment('金额');
|
||||
$table->string('title')->comment('名称');
|
||||
|
|
@ -276,7 +276,7 @@ class CreateTables extends Migration
|
|||
Schema::create('page_descriptions', function (Blueprint $table) {
|
||||
$table->comment('单页名称、描述等详情');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('page_id')->comment('单页 ID');
|
||||
$table->integer('page_id')->comment('单页 ID')->index('page_id');
|
||||
$table->string('locale')->comment('语言');
|
||||
$table->string('title')->comment('标题');
|
||||
$table->text('content')->comment('内容');
|
||||
|
|
@ -299,28 +299,28 @@ class CreateTables extends Migration
|
|||
Schema::create('products', function (Blueprint $table) {
|
||||
$table->comment('产品');
|
||||
$table->id()->startingValue(100_000)->comment('ID');
|
||||
$table->unsignedInteger('brand_id')->index()->comment('品牌 ID');
|
||||
$table->unsignedInteger('brand_id')->index()->comment('品牌 ID')->index('brand_id');
|
||||
$table->json('images')->nullable()->comment('图片');
|
||||
$table->decimal('price')->default(0)->comment('价格');
|
||||
$table->string('video')->default('')->comment('视频');
|
||||
$table->integer('position')->default(0)->comment('排序');
|
||||
$table->boolean('active')->default(0)->comment('是否启用');
|
||||
$table->json('variables')->nullable()->comment('多规格数据');
|
||||
$table->integer('tax_class_id')->default(0)->comment('税类 ID');
|
||||
$table->integer('tax_class_id')->default(0)->comment('税类 ID')->index('tax_class_id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes()->comment('删除时间');
|
||||
});
|
||||
Schema::create('product_categories', function (Blueprint $table) {
|
||||
$table->comment('产品所属分类');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedBigInteger('product_id')->comment('产品 ID');
|
||||
$table->unsignedBigInteger('category_id')->comment('分类 ID');
|
||||
$table->unsignedBigInteger('product_id')->comment('产品 ID')->index('product_id');
|
||||
$table->unsignedBigInteger('category_id')->comment('分类 ID')->index('category_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
Schema::create('product_descriptions', function (Blueprint $table) {
|
||||
$table->comment('产品名称、描述等详情');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedBigInteger('product_id')->comment('产品 ID');
|
||||
$table->unsignedBigInteger('product_id')->comment('产品 ID')->index('product_id');
|
||||
$table->string('locale')->comment('语言');
|
||||
$table->string('name')->comment('产品名称');
|
||||
$table->text('content')->comment('产品描述');
|
||||
|
|
@ -332,7 +332,7 @@ class CreateTables extends Migration
|
|||
Schema::create('product_skus', function (Blueprint $table) {
|
||||
$table->comment('产品SKU');
|
||||
$table->id()->startingValue(100_000)->comment('ID');
|
||||
$table->unsignedBigInteger('product_id')->comment('产品 ID');
|
||||
$table->unsignedBigInteger('product_id')->comment('产品 ID')->index('product_id');
|
||||
$table->json('variants')->nullable()->comment('SKU 规格');
|
||||
$table->integer('position')->default(0)->comment('排序');
|
||||
$table->json('images')->nullable()->comment('图片');
|
||||
|
|
@ -359,9 +359,9 @@ class CreateTables extends Migration
|
|||
Schema::create('region_zones', function (Blueprint $table) {
|
||||
$table->comment('区域组与国家省市县关联表');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('region_id')->comment('区域组 ID');
|
||||
$table->integer('country_id')->comment('国家 ID');
|
||||
$table->integer('zone_id')->comment('省份 ID');
|
||||
$table->integer('region_id')->comment('区域组 ID')->index('region_id');
|
||||
$table->integer('country_id')->comment('国家 ID')->index('country_id');
|
||||
$table->integer('zone_id')->comment('省份 ID')->index('zone_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
|
@ -369,9 +369,9 @@ class CreateTables extends Migration
|
|||
Schema::create('rmas', function (Blueprint $table) {
|
||||
$table->comment('售后表');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedInteger('order_id')->comment('订单 ID');
|
||||
$table->unsignedInteger('order_product_id')->comment('订单商品明细 ID');
|
||||
$table->unsignedInteger('customer_id')->comment('客户 ID');
|
||||
$table->unsignedInteger('order_id')->comment('订单 ID')->index('order_id');
|
||||
$table->unsignedInteger('order_product_id')->comment('订单商品明细 ID')->index('order_product_id');
|
||||
$table->unsignedInteger('customer_id')->comment('客户 ID')->index('customer_id');
|
||||
$table->string('name')->comment('客户姓名');
|
||||
$table->string('email')->comment('客户 Email');
|
||||
$table->string('telephone')->comment('客户电话');
|
||||
|
|
@ -379,7 +379,7 @@ class CreateTables extends Migration
|
|||
$table->string('sku')->comment('SKU');
|
||||
$table->integer('quantity')->comment('退货数量');
|
||||
$table->tinyInteger('opened')->comment('是否已打开包装');
|
||||
$table->unsignedInteger('rma_reason_id')->comment('售后原因 ID');
|
||||
$table->unsignedInteger('rma_reason_id')->comment('售后原因 ID')->index('rma_reason_id');
|
||||
$table->string('type')->comment('售后服务类型:退货、换货、维修、补发商品、仅退款');
|
||||
$table->string('status')->comment('状态');
|
||||
$table->text('comment')->comment('备注');
|
||||
|
|
@ -388,7 +388,7 @@ class CreateTables extends Migration
|
|||
Schema::create('rma_histories', function (Blueprint $table) {
|
||||
$table->comment('售后状态记录');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedInteger('rma_id')->comment('售后 ID');
|
||||
$table->unsignedInteger('rma_id')->comment('售后 ID')->index('rma_id');
|
||||
$table->string('status')->comment('状态');
|
||||
$table->tinyInteger('notify')->comment('是否通知');
|
||||
$table->text('comment')->comment('备注');
|
||||
|
|
@ -424,7 +424,7 @@ class CreateTables extends Migration
|
|||
Schema::create('tax_rates', function (Blueprint $table) {
|
||||
$table->comment('税率');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('region_id')->comment('区域组 ID');
|
||||
$table->integer('region_id')->comment('区域组 ID')->index('region_id');
|
||||
$table->string('name')->comment('名称');
|
||||
$table->string('rate')->comment('税率值');
|
||||
$table->enum('type', ['percent', 'flat'])->comment('类型, percent:百分比, flat:固定值');
|
||||
|
|
@ -433,8 +433,8 @@ class CreateTables extends Migration
|
|||
Schema::create('tax_rules', function (Blueprint $table) {
|
||||
$table->comment('税费规则');
|
||||
$table->id()->comment('ID');
|
||||
$table->integer('tax_class_id')->comment('税类 ID');
|
||||
$table->integer('tax_rate_id')->comment('税率 ID');
|
||||
$table->integer('tax_class_id')->comment('税类 ID')->index('tax_class_id');
|
||||
$table->integer('tax_rate_id')->comment('税率 ID')->index('tax_rate_id');
|
||||
$table->enum('based', ['store', 'payment', 'shipping'])->comment('地址类型');
|
||||
$table->integer('priority')->comment('优先级');
|
||||
$table->timestamps();
|
||||
|
|
@ -454,7 +454,7 @@ class CreateTables extends Migration
|
|||
Schema::create('zones', function (Blueprint $table) {
|
||||
$table->comment('省份、州');
|
||||
$table->id()->comment('ID');
|
||||
$table->unsignedInteger('country_id')->comment('国家 ID');
|
||||
$table->unsignedInteger('country_id')->comment('国家 ID')->index('country_id');
|
||||
$table->string('name', 64)->comment('名称');
|
||||
$table->string('code', 16)->comment('编码');
|
||||
$table->integer('sort_order')->comment('排序');
|
||||
|
|
|
|||
Loading…
Reference in New Issue