MCPcopy Create free account
hub / github.com/chokcoco/iCSS / setupDatabase

Method setupDatabase

MCP/server.js:52–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 }
51
52 setupDatabase() {
53 debugLog('📂 Setting up database connection...');
54 // 更健壮的数据库路径
55 const __filename = fileURLToPath(import.meta.url);
56 const __dirname = path.dirname(__filename);
57 const dbPath = path.join(__dirname, 'data', 'icss.db');
58 debugLog(`📍 Database path: ${dbPath}`);
59 this.db = new Database.Database(dbPath, (err) => {
60 if (err) {
61 console.error('❌ Error opening database:', err);
62 this.dbInitFailed = true;
63 } else {
64 debugLog('✅ Connected to SQLite database');
65 this.initializeDatabase();
66 }
67 });
68 }
69
70 initializeDatabase() {
71 debugLog('🔧 Initializing database tables...');

Callers 1

constructorMethod · 0.95

Calls 2

initializeDatabaseMethod · 0.95
debugLogFunction · 0.70

Tested by

no test coverage detected