mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 14:16:34 +09:00
fix: resolve hive-mind database optimization errors
- Remove DEFAULT CURRENT_TIMESTAMP from ALTER TABLE statements (not supported by SQLite) - Update initial schema to include all required columns (accessed_at, access_count, compressed, size) - Fix second CREATE TABLE statements to include priority, completed_at, and updated_at columns - Ensure both schema creation paths have consistent column definitions - Tested with fresh databases and existing swarms - all working correctly
This commit is contained in:
1 parent
1234849ea9
commit
c211a41579
2 files changed
+10
-3
No files matched your search
@@ -157,6 +157,10 @@ async function initHiveMind(flags) {
|
||||
confidence REAL DEFAULT 1.0,
|
||||
created_by TEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
accessed_at DATETIME,
|
||||
access_count INTEGER DEFAULT 0,
|
||||
compressed INTEGER DEFAULT 0,
|
||||
size INTEGER DEFAULT 0,
|
||||
FOREIGN KEY (swarm_id) REFERENCES swarms(id)
|
||||
);
|
||||
|
||||
@@ -427,7 +431,8 @@ async function spawnSwarm(args, flags) {
|
||||
objective TEXT,
|
||||
queen_type TEXT,
|
||||
status TEXT DEFAULT 'active',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS agents (
|
||||
@@ -448,8 +453,10 @@ async function spawnSwarm(args, flags) {
|
||||
agent_id TEXT,
|
||||
description TEXT,
|
||||
status TEXT DEFAULT 'pending',
|
||||
priority INTEGER DEFAULT 5,
|
||||
result TEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
completed_at DATETIME,
|
||||
FOREIGN KEY (swarm_id) REFERENCES swarms(id),
|
||||
FOREIGN KEY (agent_id) REFERENCES agents(id)
|
||||
);
|
||||
|
||||
@@ -260,7 +260,7 @@ function ensureRequiredColumns(db) {
|
||||
|
||||
if (!hasUpdatedAt || hasUpdatedAt.count === 0) {
|
||||
try {
|
||||
db.exec('ALTER TABLE swarms ADD COLUMN updated_at DATETIME DEFAULT CURRENT_TIMESTAMP');
|
||||
db.exec('ALTER TABLE swarms ADD COLUMN updated_at DATETIME');
|
||||
console.log('Added missing updated_at column to swarms table');
|
||||
} catch (error) {
|
||||
if (!error.message.includes('duplicate column')) {
|
||||
@@ -374,7 +374,7 @@ function addMemoryOptimization(db) {
|
||||
try {
|
||||
db.exec(`
|
||||
ALTER TABLE collective_memory
|
||||
ADD COLUMN accessed_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
ADD COLUMN accessed_at DATETIME
|
||||
`);
|
||||
console.log('Added accessed_at column to collective_memory table');
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user