snow-flow 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,6 +139,7 @@ export declare class MemorySystem extends EventEmitter {
139
139
  * Private helper methods
140
140
  */
141
141
  private createCoreTables;
142
+ private runCriticalMigrations;
142
143
  private runMigrations;
143
144
  private startCleanupTimer;
144
145
  private cleanup;
@@ -172,7 +172,9 @@ class MemorySystem extends events_1.EventEmitter {
172
172
  this.db.pragma('synchronous = NORMAL');
173
173
  // Create core tables
174
174
  await this.createCoreTables();
175
- // Run migrations if needed
175
+ // Always run critical migrations (like missing metadata column)
176
+ await this.runCriticalMigrations();
177
+ // Run optional migrations if needed
176
178
  if (this.options.schema?.autoMigrate) {
177
179
  await this.runMigrations();
178
180
  }
@@ -362,7 +364,8 @@ class MemorySystem extends events_1.EventEmitter {
362
364
  ttl INTEGER,
363
365
  expires_at INTEGER,
364
366
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
365
- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
367
+ updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
368
+ metadata TEXT DEFAULT '{}'
366
369
  );
367
370
 
368
371
  CREATE INDEX IF NOT EXISTS idx_memory_expires ON memory_store(expires_at);
@@ -483,6 +486,22 @@ class MemorySystem extends events_1.EventEmitter {
483
486
  CREATE INDEX IF NOT EXISTS idx_perf_success_time ON performance_metrics(success, created_at);
484
487
  `);
485
488
  }
489
+ async runCriticalMigrations() {
490
+ // Critical migrations that must always run
491
+ try {
492
+ // Fix for missing metadata column
493
+ const tableInfo = this.db.prepare("PRAGMA table_info(memory_store)").all();
494
+ const hasMetadataColumn = tableInfo.some((col) => col.name === 'metadata');
495
+ if (!hasMetadataColumn) {
496
+ this.logger.info('Running critical migration: Adding metadata column to memory_store table...');
497
+ this.db.exec("ALTER TABLE memory_store ADD COLUMN metadata TEXT DEFAULT '{}'");
498
+ this.logger.info('Critical migration completed: Metadata column added successfully');
499
+ }
500
+ }
501
+ catch (error) {
502
+ this.logger.warn('Could not complete critical migrations:', error);
503
+ }
504
+ }
486
505
  async runMigrations() {
487
506
  // Implement schema migrations if needed
488
507
  this.logger.info('Running database migrations...');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Snow-Flow: ServiceNow Advanced Intelligence Platform - 100+ real MCP tools with AI-powered swarm orchestration. Zero Mock Data, 100% Real API Integration. Natural language interface for ServiceNow operations.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",