update store
This commit is contained in:
@@ -13,6 +13,7 @@ use Hyperf\DbConnection\Model\Model;
|
|||||||
* @property string $platform_store_id 平台店铺 ID
|
* @property string $platform_store_id 平台店铺 ID
|
||||||
* @property array $platform_meta 平台店铺扩展信息 如 店铺所属服务商 - 平台应用 id - 平台商家 id, 平台店铺名称-区域 等根据需要补充其他额外信息
|
* @property array $platform_meta 平台店铺扩展信息 如 店铺所属服务商 - 平台应用 id - 平台商家 id, 平台店铺名称-区域 等根据需要补充其他额外信息
|
||||||
* @property int $timezone 平台店铺统计时使用的时区 默认为 +8 表示 北京时间, 如果是日本则是 +7, 填写基于 UTC 的偏移值
|
* @property int $timezone 平台店铺统计时使用的时区 默认为 +8 表示 北京时间, 如果是日本则是 +7, 填写基于 UTC 的偏移值
|
||||||
|
* @property array $auth 电商平台开放接口的授权信息(可选)
|
||||||
* @property int $warehouse_id 店铺使用的仓库 ID
|
* @property int $warehouse_id 店铺使用的仓库 ID
|
||||||
* @property int $currency_id 店铺的本币 ID
|
* @property int $currency_id 店铺的本币 ID
|
||||||
* @property boolean $enabled 激活状态
|
* @property boolean $enabled 激活状态
|
||||||
@@ -45,6 +46,7 @@ class Store extends Model
|
|||||||
'platform_store_id',
|
'platform_store_id',
|
||||||
'platform_meta',
|
'platform_meta',
|
||||||
'timezone',
|
'timezone',
|
||||||
|
'auth',
|
||||||
'warehouse_id',
|
'warehouse_id',
|
||||||
'currency_id',
|
'currency_id',
|
||||||
'enabled',
|
'enabled',
|
||||||
@@ -64,6 +66,7 @@ class Store extends Model
|
|||||||
'platform_id' => 'integer',
|
'platform_id' => 'integer',
|
||||||
'platform_meta' => 'array',
|
'platform_meta' => 'array',
|
||||||
'timezone' => 'integer',
|
'timezone' => 'integer',
|
||||||
|
'auth' => 'array',
|
||||||
'warehouse_id' => 'integer',
|
'warehouse_id' => 'integer',
|
||||||
'currency_id' => 'integer',
|
'currency_id' => 'integer',
|
||||||
'enabled' => 'boolean',
|
'enabled' => 'boolean',
|
||||||
|
|||||||
+10
-2
@@ -24,10 +24,17 @@ return new class extends Migration
|
|||||||
->default(8)
|
->default(8)
|
||||||
->after('platform_meta')
|
->after('platform_meta')
|
||||||
->comment('平台店铺统计时使用的时区 默认为 +8 表示 北京时间, 如果是日本则是 +7, 填写基于 UTC 的偏移值');
|
->comment('平台店铺统计时使用的时区 默认为 +8 表示 北京时间, 如果是日本则是 +7, 填写基于 UTC 的偏移值');
|
||||||
|
|
||||||
|
// 在 timezone 后添加 auth 字段
|
||||||
|
$table->jsonb('auth')
|
||||||
|
->nullable()
|
||||||
|
->after('timezone')
|
||||||
|
->comment('电商平台开放接口的授权信息(可选)');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 为 platform_meta JSONB 字段创建 GIN 索引,支持高效的 JSON 查询
|
// 为 JSONB 字段创建 GIN 索引,支持高效的 JSON 查询
|
||||||
Db::statement('CREATE INDEX idx_stores_platform_meta ON stores USING GIN (platform_meta)');
|
Db::statement('CREATE INDEX idx_stores_platform_meta ON stores USING GIN (platform_meta)');
|
||||||
|
Db::statement('CREATE INDEX idx_stores_auth ON stores USING GIN (auth)');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,10 +44,11 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
// 删除 GIN 索引
|
// 删除 GIN 索引
|
||||||
Db::statement('DROP INDEX IF EXISTS idx_stores_platform_meta');
|
Db::statement('DROP INDEX IF EXISTS idx_stores_platform_meta');
|
||||||
|
Db::statement('DROP INDEX IF EXISTS idx_stores_auth');
|
||||||
|
|
||||||
Schema::table('stores', function (Blueprint $table) {
|
Schema::table('stores', function (Blueprint $table) {
|
||||||
// 删除添加的字段
|
// 删除添加的字段
|
||||||
$table->dropColumn(['platform_meta', 'timezone']);
|
$table->dropColumn(['platform_meta', 'timezone', 'auth']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user