fix(GOV-012): 兼容 MySQL 5.7 视图目录并封存 v0.0.9 基线
This commit is contained in:
@@ -153,6 +153,49 @@ test('目录查询使用固定参数和超时并返回稳定对象', async () =>
|
||||
}
|
||||
});
|
||||
|
||||
test('MySQL 5.7 缺少 VIEW_TABLE_USAGE 时从 VIEWS 定义解析依赖', async () => {
|
||||
const fallback = createCatalogConnection();
|
||||
const connection = {
|
||||
calls: fallback.calls,
|
||||
async query(options) {
|
||||
if (options.sql.includes('information_schema.VIEW_TABLE_USAGE')) {
|
||||
throw Object.assign(new Error('unknown metadata table'), { code: 'ER_UNKNOWN_TABLE' });
|
||||
}
|
||||
if (options.sql.includes('information_schema.VIEWS')) {
|
||||
return [
|
||||
[
|
||||
{
|
||||
VIEW_NAME: 'market_dashboard',
|
||||
VIEW_DEFINITION:
|
||||
'SELECT * FROM `a_share_analysis_dev`.`market_summary`',
|
||||
},
|
||||
{
|
||||
VIEW_NAME: 'market_summary',
|
||||
VIEW_DEFINITION: 'SELECT * FROM `market_snapshot`',
|
||||
},
|
||||
],
|
||||
[],
|
||||
];
|
||||
}
|
||||
return fallback.query(options);
|
||||
},
|
||||
};
|
||||
|
||||
const catalog = await readSchemaCatalog(connection, 'a_share_analysis_dev', DEFAULT_EXPORT_LIMITS);
|
||||
assert.deepEqual(catalog.viewDependencies, [
|
||||
{
|
||||
view: 'market_dashboard',
|
||||
referencedSchema: 'a_share_analysis_dev',
|
||||
referencedObject: 'market_summary',
|
||||
},
|
||||
{
|
||||
view: 'market_summary',
|
||||
referencedSchema: 'a_share_analysis_dev',
|
||||
referencedObject: 'market_snapshot',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test('视图按依赖拓扑排序且同层按名称稳定排序', () => {
|
||||
const catalog = {
|
||||
tables: ['market_snapshot'],
|
||||
|
||||
Reference in New Issue
Block a user