mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
feat: #10000 代码优化
This commit is contained in:
parent
2de3c6b8bf
commit
c67ea8380e
@ -16,7 +16,7 @@ class CreateUsersTable extends Migration
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('name')->unique();
|
||||
$table->string('email')->nullable()->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
@ -25,7 +25,6 @@ class CreateUsersTable extends Migration
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
// 索引
|
||||
$table->unique('name');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -16,11 +16,10 @@ class CreateGoodsTypesTable extends Migration
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('goods_types', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name')->nullable(false);
|
||||
$table->string('name')->unique();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
// 索引
|
||||
$table->unique('name');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -16,11 +16,10 @@ class CreateGoodsBrandsTable extends Migration
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('goods_brands', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name')->nullable(false);
|
||||
$table->string('name')->unique();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
// 索引
|
||||
$table->unique('name');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -16,14 +16,13 @@ class CreateGoodsTable extends Migration
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('goods', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('title')->nullable(false);
|
||||
$table->string('title');
|
||||
$table->string('img_url')->nullable()->comment('商品图片');
|
||||
$table->unsignedBigInteger('type_id')->nullable(false)->comment('商品种类id');
|
||||
$table->unsignedBigInteger('type_id')->comment('商品种类id');
|
||||
$table->unsignedBigInteger('brand_id')->nullable()->comment('商品品牌id');
|
||||
$table->string('goods_code', 32)->nullable(false)->comment('商品编码');
|
||||
$table->string('goods_code', 32)->unique()->comment('商品编码');
|
||||
$table->timestamps();
|
||||
// 索引
|
||||
$table->unique('goods_code');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -16,9 +16,9 @@ class CreateGoodsSkusTable extends Migration
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('goods_skus', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('goods_id')->nullable(false)->comment('商品id');
|
||||
$table->string('title')->nullable(false)->comment('商品规格');
|
||||
$table->string('sku_code', 32)->nullable(false)->comment('规格编码');
|
||||
$table->unsignedBigInteger('goods_id')->comment('商品id');
|
||||
$table->string('title')->comment('商品规格');
|
||||
$table->string('sku_code', 32)->comment('规格编码');
|
||||
$table->unsignedTinyInteger('status')->default(0)->comment('规格状态(0-下架,1在售,2预警)');
|
||||
$table->unsignedInteger('num')->default(0)->comment('总量');
|
||||
$table->unsignedInteger('stock')->default(0)->comment('库存');
|
||||
|
||||
@ -15,8 +15,8 @@ class CreateDailyStockRecordsTable extends Migration
|
||||
{
|
||||
Schema::create('daily_stock_records', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->bigInteger('sku_id')->nullable(false);
|
||||
$table->date('day')->nullable(false);
|
||||
$table->bigInteger('sku_id');
|
||||
$table->date('day');
|
||||
$table->unsignedInteger('arrived_today_num')->default(0)->comment('今日到货');
|
||||
$table->unsignedInteger('loss_num')->default(0)->comment('损耗');
|
||||
$table->unsignedInteger('inventory')->default(0)->comment('库存盘点');
|
||||
|
||||
@ -24,8 +24,9 @@ class CreateLogsTable extends Migration
|
||||
$table->text('after_update')->nullable()->comment('更新后数据');
|
||||
$table->text('message')->nullable()->comment('备注信息');
|
||||
$table->bigInteger('user_id')->comment('操作人id');
|
||||
$table->index(['target_type', 'target_id', 'target_field']);
|
||||
$table->timestamps();
|
||||
// 索引
|
||||
$table->index(['target_type', 'target_id', 'target_field']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -16,14 +16,13 @@ class CreateMenusTable extends Migration
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('menus', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('code', 32)->nullable(false)->comment('菜单编码');
|
||||
$table->string('name', 32)->nullable(false)->comment('菜单名称');
|
||||
$table->string('code', 32)->unique()->comment('菜单编码');
|
||||
$table->string('name', 32)->comment('菜单名称');
|
||||
$table->unsignedBigInteger('parent_id')->default(0);
|
||||
$table->unsignedInteger('seq')->default(0)->comment('排序序号');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
// 索引
|
||||
$table->unique('code');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -28,9 +28,10 @@ class CreateShopsTable extends Migration
|
||||
$table->unsignedInteger('refresh_token_expires_in')->nullable()->comment('refresh_token过期时间段,10表示10秒后过期');
|
||||
$table->text('scope')->nullable()->comment('接口列表');
|
||||
$table->text('pop_auth_token_create_response')->nullable()->comment('授权认证信息');
|
||||
$table->unsignedTinyInteger('status')->default(0)->comment('状态');
|
||||
$table->unsignedTinyInteger('status')->index()->default(0)->comment('状态');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
//索引
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -55,6 +55,8 @@ class CreateBusinessOrdersTable extends Migration
|
||||
$table->string('transaction_id')->nullable();
|
||||
$table->integer('verification_status')->nullable();
|
||||
$table->timestamps();
|
||||
// 索引
|
||||
$table->unique(['shop_id', 'order_sn']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +39,8 @@ class CreateBusinessOrderItemsTable extends Migration
|
||||
$table->string('thumb_url')->nullable();
|
||||
$table->integer('verification_number')->nullable();
|
||||
$table->timestamps();
|
||||
// 索引
|
||||
$table->index(['shop_id', 'business_order_id', 'goods_id', 'sku_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user