优化
This commit is contained in:
@@ -10,19 +10,23 @@ const unifiedSql = readFileSync(fileURLToPath(new URL('../../deploy/sql/头程
|
||||
test('unified migration selects firstleg before creating the loading model bridge', () => {
|
||||
assert.match(
|
||||
unifiedSql,
|
||||
/USE baiyue_firstleg;\s*\/\* Phase 3: link inbound preload plans to one or more container loading plans\. \*\/\s*CREATE TABLE IF NOT EXISTS fl_preload_loading_plan_link/,
|
||||
/USE baiyue_firstleg;[\s\S]*?CREATE TABLE(?: IF NOT EXISTS)? fl_preload_loading_plan_link/,
|
||||
)
|
||||
})
|
||||
|
||||
test('unified migration converges declaration ledger table comments before final schema validation', () => {
|
||||
assert.match(unifiedSql, /queue_table_comment\('baiyue_firstleg', 'fl_order_declaration_event', '[^']*[一-龥][^']*'\)/)
|
||||
assert.match(unifiedSql, /queue_table_comment\('baiyue_firstleg', 'fl_order_declaration_snapshot', '[^']*[一-龥][^']*'\)/)
|
||||
test('unified baseline defines declaration ledger comments before final schema validation', () => {
|
||||
const eventStart = unifiedSql.indexOf('CREATE TABLE fl_order_declaration_event')
|
||||
const snapshotStart = unifiedSql.indexOf('CREATE TABLE fl_order_declaration_snapshot')
|
||||
const eventTable = unifiedSql.slice(eventStart, snapshotStart)
|
||||
const snapshotTable = unifiedSql.slice(snapshotStart, unifiedSql.indexOf('CREATE TABLE', snapshotStart + 20))
|
||||
assert.match(eventTable, /COMMENT='Order客户申报事件永久幂等账本'/)
|
||||
assert.match(snapshotTable, /COMMENT='Order客户申报版本快照/)
|
||||
for (const column of ['tenant_id', 'event_id', 'order_id', 'order_version', 'request_hash', 'consumed_at']) {
|
||||
assert.match(unifiedSql, new RegExp(`queue_column_comment\\('baiyue_firstleg','fl_order_declaration_event','${column}','[^']*[一-龥][^']*'\\)`))
|
||||
assert.match(eventTable, new RegExp(`\\b${column}\\b[^\\n]*COMMENT '[^']*[一-龥][^']*'`))
|
||||
}
|
||||
for (const column of ['tenant_id', 'order_id', 'event_id', 'order_version', 'request_hash', 'customer_remark',
|
||||
'expected_arrival_at', 'channel_code', 'channel_name', 'cargoes_json', 'changes_json', 'occurred_at', 'created_at', 'updated_at']) {
|
||||
assert.match(unifiedSql, new RegExp(`queue_column_comment\\('baiyue_firstleg','fl_order_declaration_snapshot','${column}','[^']*[一-龥][^']*'\\)`))
|
||||
assert.match(snapshotTable, new RegExp(`\\b${column}\\b[^\\n]*COMMENT '[^']*[一-龥][^']*'`))
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user