@@ -267,53 +267,37 @@ export class CliHistoryStore {
267267 const hasProjectRoot = tableInfo . some ( col => col . name === 'project_root' ) ;
268268 const hasRelativePath = tableInfo . some ( col => col . name === 'relative_path' ) ;
269269
270+ // Silent migrations - only log warnings/errors
270271 if ( ! hasCategory ) {
271- console . log ( '[CLI History] Migrating database: adding category column...' ) ;
272- this . db . exec ( `
273- ALTER TABLE conversations ADD COLUMN category TEXT DEFAULT 'user';
274- ` ) ;
275- // Create index separately to handle potential errors
272+ this . db . exec ( `ALTER TABLE conversations ADD COLUMN category TEXT DEFAULT 'user';` ) ;
276273 try {
277274 this . db . exec ( `CREATE INDEX IF NOT EXISTS idx_conversations_category ON conversations(category);` ) ;
278275 } catch ( indexErr ) {
279276 console . warn ( '[CLI History] Category index creation warning:' , ( indexErr as Error ) . message ) ;
280277 }
281- console . log ( '[CLI History] Migration complete: category column added' ) ;
282278 }
283279
284280 if ( ! hasParentExecutionId ) {
285- console . log ( '[CLI History] Migrating database: adding parent_execution_id column...' ) ;
286- this . db . exec ( `
287- ALTER TABLE conversations ADD COLUMN parent_execution_id TEXT;
288- ` ) ;
281+ this . db . exec ( `ALTER TABLE conversations ADD COLUMN parent_execution_id TEXT;` ) ;
289282 try {
290283 this . db . exec ( `CREATE INDEX IF NOT EXISTS idx_conversations_parent ON conversations(parent_execution_id);` ) ;
291284 } catch ( indexErr ) {
292285 console . warn ( '[CLI History] Parent execution index creation warning:' , ( indexErr as Error ) . message ) ;
293286 }
294- console . log ( '[CLI History] Migration complete: parent_execution_id column added' ) ;
295287 }
296288
297289 // Add hierarchical storage support columns
298290 if ( ! hasProjectRoot ) {
299- console . log ( '[CLI History] Migrating database: adding project_root column for hierarchical storage...' ) ;
300- this . db . exec ( `
301- ALTER TABLE conversations ADD COLUMN project_root TEXT;
302- ` ) ;
291+ this . db . exec ( `ALTER TABLE conversations ADD COLUMN project_root TEXT;` ) ;
303292 try {
304293 this . db . exec ( `CREATE INDEX IF NOT EXISTS idx_conversations_project_root ON conversations(project_root);` ) ;
305294 } catch ( indexErr ) {
306295 console . warn ( '[CLI History] Project root index creation warning:' , ( indexErr as Error ) . message ) ;
307296 }
308- console . log ( '[CLI History] Migration complete: project_root column added' ) ;
309297 }
310298
311299 if ( ! hasRelativePath ) {
312- console . log ( '[CLI History] Migrating database: adding relative_path column for hierarchical storage...' ) ;
313- this . db . exec ( `
314- ALTER TABLE conversations ADD COLUMN relative_path TEXT;
315- ` ) ;
316- console . log ( '[CLI History] Migration complete: relative_path column added' ) ;
300+ this . db . exec ( `ALTER TABLE conversations ADD COLUMN relative_path TEXT;` ) ;
317301 }
318302
319303 // Add missing timestamp index for turns table (for time-based queries)
@@ -324,9 +308,7 @@ export class CliHistoryStore {
324308 ` ) . get ( ) ;
325309
326310 if ( ! indexExists ) {
327- console . log ( '[CLI History] Adding missing timestamp index to turns table...' ) ;
328311 this . db . exec ( `CREATE INDEX IF NOT EXISTS idx_turns_timestamp ON turns(timestamp DESC);` ) ;
329- console . log ( '[CLI History] Migration complete: turns timestamp index added' ) ;
330312 }
331313 } catch ( indexErr ) {
332314 console . warn ( '[CLI History] Turns timestamp index creation warning:' , ( indexErr as Error ) . message ) ;
@@ -353,32 +335,24 @@ export class CliHistoryStore {
353335 }
354336 }
355337
356- // Batch migration - only output log if there are columns to migrate
338+ // Batch migration - silent
357339 if ( missingTurnsColumns . length > 0 ) {
358- console . log ( `[CLI History] Migrating turns table: adding ${ missingTurnsColumns . length } columns (${ missingTurnsColumns . join ( ', ' ) } )...` ) ;
359-
360340 for ( const col of missingTurnsColumns ) {
361341 this . db . exec ( `ALTER TABLE turns ADD COLUMN ${ col } ${ turnsColumnDefs [ col ] } ;` ) ;
362342 }
363-
364- console . log ( '[CLI History] Migration complete: turns table updated' ) ;
365343 }
366344
367345 // Add transaction_id column to native_session_mapping table for concurrent session disambiguation
368346 const mappingInfo = this . db . prepare ( 'PRAGMA table_info(native_session_mapping)' ) . all ( ) as Array < { name : string } > ;
369347 const hasTransactionId = mappingInfo . some ( col => col . name === 'transaction_id' ) ;
370348
371349 if ( ! hasTransactionId ) {
372- console . log ( '[CLI History] Migrating database: adding transaction_id column to native_session_mapping...' ) ;
373- this . db . exec ( `
374- ALTER TABLE native_session_mapping ADD COLUMN transaction_id TEXT;
375- ` ) ;
350+ this . db . exec ( `ALTER TABLE native_session_mapping ADD COLUMN transaction_id TEXT;` ) ;
376351 try {
377352 this . db . exec ( `CREATE INDEX IF NOT EXISTS idx_native_transaction_id ON native_session_mapping(transaction_id);` ) ;
378353 } catch ( indexErr ) {
379354 console . warn ( '[CLI History] Transaction ID index creation warning:' , ( indexErr as Error ) . message ) ;
380355 }
381- console . log ( '[CLI History] Migration complete: transaction_id column added' ) ;
382356 }
383357 } catch ( err ) {
384358 console . error ( '[CLI History] Migration error:' , ( err as Error ) . message ) ;
0 commit comments