feat: Add 5Why_ prefix to all database tables

- Rename all tables with 5Why_ prefix for namespace isolation
- Update models: User.js, Analysis.js, AuditLog.js
- Update routes: llmConfig.js
- Update scripts: seed-test-users.js, add-deepseek-config.js, add-ollama-config.js
- Add migrate-table-prefix.js script for database migration
- Update db_schema.sql with new table names
- Update views: 5Why_user_analysis_stats, 5Why_recent_analyses

Tables renamed:
- users -> 5Why_users
- analyses -> 5Why_analyses
- analysis_perspectives -> 5Why_analysis_perspectives
- analysis_whys -> 5Why_analysis_whys
- llm_configs -> 5Why_llm_configs
- system_settings -> 5Why_system_settings
- audit_logs -> 5Why_audit_logs
- sessions -> 5Why_sessions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
donald
2025-12-09 18:19:53 +08:00
parent 66cdcacce9
commit f9ee43b73c
9 changed files with 552 additions and 62 deletions

View File

@@ -17,7 +17,7 @@ async function addDeepSeekConfig() {
try {
// Check if DeepSeek config already exists
const existing = await query(
`SELECT id FROM llm_configs WHERE provider_name = 'DeepSeek' LIMIT 1`
`SELECT id FROM 5Why_llm_configs WHERE provider = 'DeepSeek' LIMIT 1`
);
if (existing.length > 0) {
@@ -35,12 +35,12 @@ async function addDeepSeekConfig() {
}
// First, deactivate all existing configs
await query('UPDATE llm_configs SET is_active = 0');
await query('UPDATE 5Why_llm_configs SET is_active = 0');
// Insert DeepSeek configuration
const result = await query(
`INSERT INTO llm_configs
(provider_name, api_endpoint, api_key, model_name, temperature, max_tokens, timeout_seconds, is_active)
`INSERT INTO 5Why_llm_configs
(provider, api_url, api_key, model_name, temperature, max_tokens, timeout, is_active)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
[
'DeepSeek',
@@ -49,7 +49,7 @@ async function addDeepSeekConfig() {
process.env.DEEPSEEK_MODEL || 'deepseek-chat',
0.7,
6000,
120,
120000,
1 // Set as active
]
);