This commit is contained in:
2026-09-20 19:57:47 +08:00
parent db07111e63
commit bd03ed5671
17 changed files with 210 additions and 97 deletions
@@ -9,7 +9,9 @@ const migrations = {
iam: 'deploy/sql/migrations/cn/baiyue_iam/V1__align_schema_baseline.sql',
firstleg: 'deploy/sql/migrations/cn/baiyue_firstleg/V1__align_schema_baseline.sql',
file: 'deploy/sql/migrations/cn/baiyue_file/V1__align_schema_baseline.sql',
fileForwardFix: 'deploy/sql/migrations/cn/baiyue_file/V2__widen_business_type.sql',
lastleg: 'deploy/sql/migrations/overseas/baiyue_lastleg/V2__align_schema_baseline.sql',
lastlegForwardFix: 'deploy/sql/migrations/overseas/baiyue_lastleg/V3__relax_valid_nullable_fields.sql',
}
async function sources() {
@@ -30,10 +32,14 @@ test('schema alignment migrations cover the verified drift', async () => {
for (const field of ['tenant_code', 'customer_nickname', 'original_file_name']) assert.match(source.iam, new RegExp(`\\b${field}\\b`))
assert.match(source.firstleg, /\bpallet_no\b/)
for (const table of ['file_pda_release_channel', 'file_pda_release']) assert.match(source.file, new RegExp(`\\b${table}\\b`))
assert.match(source.fileForwardFix, /business_type\s+varchar\(64\)/i)
for (const field of [
'actual_discard_packages', 'pda_status', 'pda_operator_id', 'pda_completed_at',
'quantity', 'pallet_code', 'discrepancy_reason', 'manually_completed_at',
]) assert.match(source.lastleg, new RegExp(`\\b${field}\\b`))
for (const field of ['inventory_position_id', 'new_sku_code', 'source_warehouse_id']) {
assert.match(source.lastlegForwardFix, new RegExp(`\\b${field}\\b`))
}
})
test('constraint tightening is guarded before any alter table', async () => {