@mmmbuto/nexuscli 0.9.7002-termux → 0.9.7003-termux

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.
@@ -64,6 +64,7 @@ function initSchema() {
64
64
  content TEXT NOT NULL,
65
65
  created_at INTEGER NOT NULL,
66
66
  metadata TEXT,
67
+ engine TEXT NOT NULL DEFAULT 'claude',
67
68
  FOREIGN KEY (conversation_id) REFERENCES conversations(id) ON DELETE CASCADE
68
69
  );
69
70
 
@@ -0,0 +1,45 @@
1
+ -- ============================================================
2
+ -- MIGRATION 005: Fix engine column to NOT NULL
3
+ -- Ensures all messages have a valid engine field for proper avatar display
4
+ -- ============================================================
5
+
6
+ -- Step 1: Backfill any NULL values to 'claude' (safe default)
7
+ UPDATE messages SET engine = 'claude' WHERE engine IS NULL OR engine = '';
8
+
9
+ -- Step 2: Recreate messages table with NOT NULL constraint
10
+ -- SQLite doesn't support ALTER COLUMN directly, so we recreate
11
+
12
+ -- Create new table with proper schema
13
+ CREATE TABLE IF NOT EXISTS messages_new (
14
+ id TEXT PRIMARY KEY,
15
+ conversation_id TEXT NOT NULL,
16
+ role TEXT NOT NULL CHECK(role IN ('user', 'assistant', 'system')),
17
+ content TEXT NOT NULL,
18
+ created_at INTEGER NOT NULL,
19
+ metadata TEXT,
20
+ engine TEXT NOT NULL DEFAULT 'claude',
21
+ FOREIGN KEY (conversation_id) REFERENCES conversations(id) ON DELETE CASCADE
22
+ );
23
+
24
+ -- Copy all data from old table to new table
25
+ INSERT INTO messages_new
26
+ SELECT id, conversation_id, role, content, created_at, metadata,
27
+ COALESCE(engine, 'claude') AS engine
28
+ FROM messages;
29
+
30
+ -- Drop old table
31
+ DROP TABLE messages;
32
+
33
+ -- Rename new table to original name
34
+ ALTER TABLE messages_new RENAME TO messages;
35
+
36
+ -- Step 3: Recreate all indexes
37
+ CREATE INDEX IF NOT EXISTS idx_messages_conversation_id ON messages(conversation_id);
38
+ CREATE INDEX IF NOT EXISTS idx_messages_created_at ON messages(created_at ASC);
39
+ CREATE INDEX IF NOT EXISTS idx_messages_engine ON messages(engine);
40
+ CREATE INDEX IF NOT EXISTS idx_messages_conversation_engine ON messages(conversation_id, engine);
41
+
42
+ -- Verification query ( informational only )
43
+ SELECT 'Messages with NULL engine (should be 0):' as check_name,
44
+ COUNT(*) as count
45
+ FROM messages WHERE engine IS NULL;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmmbuto/nexuscli",
3
- "version": "0.9.7002-termux",
3
+ "version": "0.9.7003-termux",
4
4
  "description": "NexusCLI - TRI CLI Control Plane (Claude/Codex/Gemini/Qwen)",
5
5
  "main": "lib/server/server.js",
6
6
  "bin": {