feat(assets): 优化移动端分析体验并记录 AI 提问日志
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
// Import the pool only after an explicit apply flag, to avoid accidental connections in review mode.
|
||||
const sql = await readFile(new URL('../migrations/20260928_asset_ai_questions.sql', import.meta.url), 'utf8');
|
||||
if (!process.argv.includes('--apply')) {
|
||||
console.log(sql);
|
||||
console.log('Review only. To create this audit table in the configured DB, pass --apply.');
|
||||
} else {
|
||||
const { default: pool } = await import('../src/server/db.js');
|
||||
try {
|
||||
await pool.query(sql);
|
||||
const [rows] = await pool.query('SELECT COUNT(*) AS columns_count FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name=?', ['bi_asset_ai_questions']);
|
||||
console.log('AI question audit table ready.', rows);
|
||||
} finally {
|
||||
await pool.end();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user