chore(db): 合并寄卖迁移为 152,保留 main 147-151 编号

- main 分支 147-151 保持原编号不变
- dev 寄卖迁移 147-158 合并为单一 152_consignment_platform.sql
- 同步迁移头注释与测试文件引用
- 开发库已补跑 main 147-151,并将 schema_migrations 收敛为 152 单条
This commit is contained in:
2026-11-09 13:50:06 +08:00
parent 335501d0c2
commit e5d6e92966
10 changed files with 201 additions and 192 deletions
@@ -12,10 +12,7 @@ const ISSUE_REPO = new URL(
import.meta.url,
)
const FULFILLMENT = new URL('./consignment-fulfillment-service.ts', import.meta.url)
const MIGRATION = new URL(
'../../db/migrations/151_work_order_internal_matching_deadline_guard.sql',
import.meta.url,
)
const MIGRATION = new URL('../../db/migrations/152_consignment_platform.sql', import.meta.url)
test('手动匹配不再在事务外改状态:数量不足/并发占库失败不能留下无截止时间的 internal_matching', async () => {
const source = await readFile(ENGINE, 'utf8')
@@ -149,9 +149,9 @@ test('降价提示:未售出时长支持一位小数,按小数小时判断',
assert.equal(suggestion?.suggestedPriceFen, 9_000)
})
test('合并迁移 147 必须包含寄卖配置、库存数量/售价与分配表', async () => {
test('合并迁移 152 必须包含寄卖配置、库存数量/售价与分配表', async () => {
const source = await readFile(
new URL('../../db/migrations/147_consignment_platform.sql', import.meta.url),
new URL('../../db/migrations/152_consignment_platform.sql', import.meta.url),
'utf8',
)
for (const fragment of [
@@ -163,7 +163,7 @@ test('合并迁移 147 必须包含寄卖配置、库存数量/售价与分配
'internal_match_deadline_at',
'consignment_inventory_id',
]) {
assert.ok(source.includes(fragment), `合并迁移 147 缺少 ${fragment}`)
assert.ok(source.includes(fragment), `合并迁移 152 缺少 ${fragment}`)
}
})
@@ -214,9 +214,9 @@ test('寄售数量上限按分类统计,并在打手配置接口返回 activeQ
assert.ok(source.includes('GROUP BY profile_id'), '各分类数量必须一次分组取回')
})
test('合并迁移 147 的苏尔南种子:降价提示默认开启、24 小时、按比例 10%', async () => {
test('合并迁移 152 的苏尔南种子:降价提示默认开启、24 小时、按比例 10%', async () => {
const sql = await readFile(
new URL('../../db/migrations/147_consignment_platform.sql', import.meta.url),
new URL('../../db/migrations/152_consignment_platform.sql', import.meta.url),
'utf8',
)
assert.match(
@@ -36,7 +36,7 @@ function option(label: string, value: string) {
return { label, value, enabled: true }
}
/** 苏尔南手枪种子配置的五个字段(与合并迁移 147 一致)。 */
/** 苏尔南手枪种子配置的五个字段(与合并迁移 152 一致)。 */
function surnanSpecs(): ConsignmentSpecField[] {
return [
{
@@ -522,9 +522,9 @@ test('动态规格:旧列仍由兼容 key 同步', () => {
})
})
test('合并迁移 147 必须包含动态规格的 JSON、匹配 key、文本与改价上限', async () => {
test('合并迁移 152 必须包含动态规格的 JSON、匹配 key、文本与改价上限', async () => {
const sql = await readFile(
new URL('../../db/migrations/147_consignment_platform.sql', import.meta.url),
new URL('../../db/migrations/152_consignment_platform.sql', import.meta.url),
'utf8',
)
for (const fragment of [
@@ -534,7 +534,7 @@ test('合并迁移 147 必须包含动态规格的 JSON、匹配 key、文本与
'price_cap_fen',
'CREATE INDEX IF NOT EXISTS idx_consignment_inventories_spec_key',
]) {
assert.ok(sql.includes(fragment), `合并迁移 147 缺少 ${fragment}`)
assert.ok(sql.includes(fragment), `合并迁移 152 缺少 ${fragment}`)
}
})
@@ -549,9 +549,9 @@ test('发布数量:关闭「允许修改寄售数量」时固定为 1,开启
assert.equal(resolveConsignmentPublishQuantity(true, 1.6), 2, '四舍五入')
})
test('合并迁移 147 必须为苏尔南手枪写入已发布的五个单选字段配置', async () => {
test('合并迁移 152 必须为苏尔南手枪写入已发布的五个单选字段配置', async () => {
const sql = await readFile(
new URL('../../db/migrations/147_consignment_platform.sql', import.meta.url),
new URL('../../db/migrations/152_consignment_platform.sql', import.meta.url),
'utf8',
)
for (const fragment of [
@@ -561,6 +561,6 @@ test('合并迁移 147 必须为苏尔南手枪写入已发布的五个单选字
"'published'",
'"key": "brillianceCount"',
]) {
assert.ok(sql.includes(fragment), `合并迁移 147 缺少 ${fragment}`)
assert.ok(sql.includes(fragment), `合并迁移 152 缺少 ${fragment}`)
}
})