🐛 fix(sync): 明确未迁移索引并提供补救 DDL (#885)

Fixes #885
This commit is contained in:
mango
2026-08-09 15:48:34 +08:00
parent f887deb44c
commit bb882faac7
17 changed files with 1053 additions and 237 deletions

View File

@@ -322,6 +322,23 @@ describe('data sync Wails DTO boundary', () => {
stage: 'endpoints',
message: 'unsupported route',
},
{
code: 'unmigrated_index',
severity: 'warning',
stage: 'mappings',
message: 'index requires review',
detail: {
unmigratedIndex: {
name: 'idx_name_prefix',
columns: [{ name: 'name', prefixLength: 12 }],
unique: false,
indexType: 'BTREE',
reasonCode: 'prefix_index_requires_review',
reason: 'index requires review',
remediationStatements: ['CREATE INDEX idx_name_prefix ON public.users (left(name, 12))'],
},
},
},
],
checkedAt: Date.parse('2026-08-08T00:02:00.000Z'),
},
@@ -332,7 +349,18 @@ describe('data sync Wails DTO boundary', () => {
expect(blocked.snapshot).toMatchObject({
status: 'blocked',
approvalSatisfied: false,
issues: [{ message: 'unsupported route' }],
issues: [
{ message: 'unsupported route' },
{
detail: {
unmigratedIndex: {
name: 'idx_name_prefix',
reasonCode: 'prefix_index_requires_review',
remediationStatements: ['CREATE INDEX idx_name_prefix ON public.users (left(name, 12))'],
},
},
},
],
});
const earlyBlocked = decodeDataSyncPreflightQuery(
{