- Frontend V3 architecture migration to modules/pkb - Implement three work modes: full-text reading, deep reading, batch processing - Complete batch processing: template selection, progress display, result export (CSV) - Integrate Ant Design X Chat component with streaming support - Add document upload modal with drag-and-drop support - Optimize UI: multi-line table display, citation formatting, auto-scroll - Fix 10+ technical issues: API mapping, state sync, form clearing - Update documentation: development records and module status Performance: 3 docs batch processing ~17-28s Status: PKB module now production-ready (90% complete)
113 lines
3.0 KiB
TypeScript
113 lines
3.0 KiB
TypeScript
/**
|
||
* 直接查询数据库中的iit_schema.projects表结构
|
||
*/
|
||
|
||
import { PrismaClient } from '@prisma/client';
|
||
|
||
const prisma = new PrismaClient();
|
||
|
||
async function checkTableStructure() {
|
||
try {
|
||
console.log('🔍 查询 iit_schema.projects 表结构...\n');
|
||
|
||
// 1. 查询表的所有列信息
|
||
const columns = await prisma.$queryRaw<any[]>`
|
||
SELECT
|
||
column_name,
|
||
data_type,
|
||
character_maximum_length,
|
||
is_nullable,
|
||
column_default
|
||
FROM information_schema.columns
|
||
WHERE table_schema = 'iit_schema'
|
||
AND table_name = 'projects'
|
||
ORDER BY ordinal_position
|
||
`;
|
||
|
||
console.log('📋 表结构:');
|
||
console.log('='.repeat(100));
|
||
console.log(
|
||
'Column Name'.padEnd(30) +
|
||
'Data Type'.padEnd(20) +
|
||
'Nullable'.padEnd(12) +
|
||
'Default'
|
||
);
|
||
console.log('='.repeat(100));
|
||
|
||
columns.forEach(col => {
|
||
const colName = col.column_name.padEnd(30);
|
||
const dataType = (col.data_type +
|
||
(col.character_maximum_length ? `(${col.character_maximum_length})` : '')
|
||
).padEnd(20);
|
||
const nullable = (col.is_nullable === 'YES' ? 'YES' : 'NO').padEnd(12);
|
||
const defaultVal = col.column_default || '';
|
||
|
||
console.log(`${colName}${dataType}${nullable}${defaultVal}`);
|
||
});
|
||
|
||
console.log('='.repeat(100));
|
||
console.log(`\n总计: ${columns.length} 个字段\n`);
|
||
|
||
// 2. 检查是否存在 dify 相关字段
|
||
const difyColumns = columns.filter(col =>
|
||
col.column_name.toLowerCase().includes('dify')
|
||
);
|
||
|
||
if (difyColumns.length > 0) {
|
||
console.log('✅ 找到Dify相关字段:');
|
||
difyColumns.forEach(col => {
|
||
console.log(` - ${col.column_name} (${col.data_type}, nullable: ${col.is_nullable})`);
|
||
});
|
||
} else {
|
||
console.log('❌ 未找到Dify相关字段');
|
||
}
|
||
console.log('');
|
||
|
||
// 3. 查询test0102项目的当前数据
|
||
console.log('📊 查询test0102项目的当前配置...\n');
|
||
const projects = await prisma.$queryRaw<any[]>`
|
||
SELECT
|
||
id,
|
||
name,
|
||
redcap_project_id,
|
||
redcap_url,
|
||
dify_dataset_id,
|
||
status,
|
||
created_at
|
||
FROM iit_schema.projects
|
||
WHERE redcap_project_id = '16'
|
||
`;
|
||
|
||
if (projects.length > 0) {
|
||
console.log('✅ test0102项目信息:');
|
||
const project = projects[0];
|
||
console.log(` ID: ${project.id}`);
|
||
console.log(` 名称: ${project.name}`);
|
||
console.log(` REDCap项目ID: ${project.redcap_project_id}`);
|
||
console.log(` REDCap URL: ${project.redcap_url}`);
|
||
console.log(` Dify Dataset ID: ${project.dify_dataset_id || '(未设置)'}`);
|
||
console.log(` 状态: ${project.status}`);
|
||
console.log(` 创建时间: ${project.created_at}`);
|
||
} else {
|
||
console.log('❌ 未找到test0102项目');
|
||
}
|
||
|
||
console.log('');
|
||
|
||
} catch (error) {
|
||
console.error('❌ 查询失败:', error);
|
||
} finally {
|
||
await prisma.$disconnect();
|
||
}
|
||
}
|
||
|
||
checkTableStructure();
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|