fix: 补齐快递运费汇总覆盖索引 (#145)
This commit is contained in:
parent
881796f13e
commit
a2c6388e73
@ -427,7 +427,7 @@ return [
|
||||
'jiansun.dbo.Jst_SendData_View_extension' => [
|
||||
'source_key' => 'jiansun', 'schema' => 'dbo', 'object' => 'Jst_SendData_View_extension',
|
||||
'target' => 'js_jst_send_data_view_extension', 'keys' => ['Id'], 'watermark' => null,
|
||||
'indexes' => [['so_id', 'Id'], ['io_id', 'Id']],
|
||||
'indexes' => [['so_id', 'Id'], ['io_id', 'Id'], ['so_id', 'Id', 'io_id']],
|
||||
'columns' => [
|
||||
'Id', 'io_id', 'qty', 'l', 'w', 'h', 'sku_ids', 'sku_name', 'so_id', 'shop_site',
|
||||
'shop_name', 'shop_i_id', 'supplier_name', 'receiver_state', 'receiver_city',
|
||||
@ -438,7 +438,7 @@ return [
|
||||
'jiansun.dbo.jst_salesOutboundInfo' => [
|
||||
'source_key' => 'jiansun', 'schema' => 'dbo', 'object' => 'jst_salesOutboundInfo',
|
||||
'target' => 'js_jst_sales_outbound_info', 'keys' => ['Id'], 'watermark' => 'updateTime',
|
||||
'indexes' => [['io_id', 'Id']],
|
||||
'indexes' => [['io_id', 'Id'], ['io_id', 'Id', 'freight']],
|
||||
'columns' => ['Id', 'io_id', 'modified', 'updateTime', 'f_weight', 'weight', 'f_freight', 'freight', 'pay_date', 'volume', 'f_volume'],
|
||||
],
|
||||
'jiansun.dbo.finance_boardDeduction' => ['source_key' => 'jiansun', 'schema' => 'dbo', 'object' => 'finance_boardDeduction', 'target' => 'js_finance_board_deduction', 'keys' => ['id']],
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
private const INDEXES = [
|
||||
'js_jst_send_data_view_extension' => ['idx_courier_extension_summary', ['so_id', 'Id', 'io_id']],
|
||||
'js_jst_sales_outbound_info' => ['idx_courier_outbound_summary', ['io_id', 'Id', 'freight']],
|
||||
];
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
if (config('system_database.mode', 'bootstrap') === 'bootstrap') return;
|
||||
$schema = Schema::connection((string) config('upstream_mirrors.connection', 'business_mirror'));
|
||||
foreach (self::INDEXES as $table => [$name, $columns]) {
|
||||
if (! $schema->hasTable($table) || $schema->hasIndex($table, $name)) continue;
|
||||
$schema->table($table, static fn (Blueprint $blueprint) => $blueprint->index($columns, $name));
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (config('system_database.mode', 'bootstrap') === 'bootstrap') return;
|
||||
$schema = Schema::connection((string) config('upstream_mirrors.connection', 'business_mirror'));
|
||||
foreach (self::INDEXES as $table => [$name]) {
|
||||
if (! $schema->hasTable($table) || ! $schema->hasIndex($table, $name)) continue;
|
||||
$schema->table($table, static fn (Blueprint $blueprint) => $blueprint->dropIndex($name));
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user