-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_qbits_db.sh
More file actions
executable file
·34 lines (27 loc) · 1.16 KB
/
fix_qbits_db.sh
File metadata and controls
executable file
·34 lines (27 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# fix_qbits_db.sh
# Ensures qbits table has all required columns for Neuro & crew AI
DB_FILE="$HOME/_/ai/db/ai_memory.sqlite"
if [ ! -f "$DB_FILE" ]; then
echo "[ERROR] SQLite DB not found at $DB_FILE"
exit 1
fi
echo "[INFO] Checking qbits table schema..."
# Check if 'response' column exists
COLUMN_EXISTS=$(sqlite3 "$DB_FILE" "PRAGMA table_info(qbits);" | awk -F'|' '{print $2}' | grep -w response || echo "no")
if [ "$COLUMN_EXISTS" = "response" ]; then
echo "[OK] Column 'response' already exists."
else
echo "[INFO] Adding missing column 'response'..."
sqlite3 "$DB_FILE" "ALTER TABLE qbits ADD COLUMN response TEXT;"
echo "[DONE] Column 'response' added."
fi
# Optional: ensure other columns exist (agent,prompt,hash,iteration,timestamp,temp)
REQUIRED_COLS=(agent prompt hash iteration timestamp temp)
for col in "${REQUIRED_COLS[@]}"; do
EXISTS=$(sqlite3 "$DB_FILE" "PRAGMA table_info(qbits);" | awk -F'|' '{print $2}' | grep -w "$col" || echo "no")
if [ "$EXISTS" = "no" ]; then
echo "[WARNING] Column '$col' missing! Consider recreating table with full schema."
fi
done
echo "[SUCCESS] qbits table schema validated."