This commit is contained in:
2026-09-28 17:20:39 +08:00
parent 6a3b6e22e6
commit 5816cd0958
2 changed files with 16 additions and 1 deletions
@@ -87,6 +87,19 @@ test('schema alignment migrations cover the verified drift', async () => {
assert.match(source.lastlegRelabel, /idx_ll_relabel_application_order/i)
})
test('墨家迁移保留未知重量,不因已有收件记录阻断', async () => {
const { firstlegMeasurement: source } = await sources()
assert.match(source, /ADD COLUMN weight_kg DECIMAL\(18,3\) NULL/i)
assert.match(source, /MODIFY COLUMN weight_kg DECIMAL\(18,3\) NULL/i)
assert.doesNotMatch(source, /weight_kg DECIMAL\(18,3\) NOT NULL/i)
assert.doesNotMatch(source, /FROM\s+fl_mojia_measurement_receipt\b/i)
assert.match(source, /migration_blocked_firstleg_mojia_receipt_table_missing/)
const module = await readFile(path.join(repositoryRoot, 'firstleg/src/main/resources/db/phase2-inbound-schema.sql'), 'utf8')
const receipt = module.match(/CREATE TABLE IF NOT EXISTS fl_mojia_measurement_receipt\s*\(([\s\S]*?)\n\) ENGINE=/i)?.[1]
assert.ok(receipt, '必须保留墨家收件表定义')
assert.match(receipt, /weight_kg DECIMAL\(18,3\) NULL/i)
})
test('constraint tightening is guarded before any alter table', async () => {
for (const [name, source] of Object.entries(await sources())) {
const firstAlter = source.search(/\bALTER TABLE\b/i)