Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
chore: consolidate D1 migrations into 0001_schema.sql
Gener59ccc3bb1ea7
diff --git a/src/web/migrations/0001_schema.sql b/src/web/migrations/0001_schema.sqlindex 2f5b0a951..b588f2575 100644--- a/src/web/migrations/0001_schema.sql+++ b/src/web/migrations/0001_schema.sql@@ -72,6 +72,16 @@ CREATE TABLE IF NOT EXISTS member (UNIQUE(workspace_id, user_id));+CREATE TABLE IF NOT EXISTS machine (+ daemon_id TEXT NOT NULL,+ workspace_id TEXT NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,+ device_info TEXT NOT NULL DEFAULT '',+ last_seen_at TEXT,+ created_at TEXT NOT NULL DEFAULT (datetime('now')),+ updated_at TEXT NOT NULL DEFAULT (datetime('now')),+ PRIMARY KEY (workspace_id, daemon_id)+);+CREATE TABLE IF NOT EXISTS agent_runtime (id TEXT PRIMARY KEY,workspace_id TEXT NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,@@ -147,6 +157,7 @@ CREATE TABLE IF NOT EXISTS agent_task_queue (workspace_id TEXT NOT NULL REFERENCES workspace(id),conversation_id TEXT NOT NULL REFERENCES conversation(id),prompt TEXT NOT NULL,+ type TEXT NOT NULL DEFAULT 'user_dm_message',status TEXT NOT NULL DEFAULT 'queued',priority INTEGER NOT NULL DEFAULT 0,result TEXT,@@ -160,10 +171,6 @@ CREATE TABLE IF NOT EXISTS agent_task_queue (FOREIGN KEY (agent_id, workspace_id) REFERENCES agent(id, workspace_id) ON DELETE CASCADE);-CREATE UNIQUE INDEX IF NOT EXISTS idx_one_pending_per_conversation- ON agent_task_queue(conversation_id)- WHERE status IN ('queued', 'dispatched');-CREATE INDEX IF NOT EXISTS idx_task_queue_pendingON agent_task_queue(agent_id, status)WHERE status IN ('queued', 'dispatched');@@ -195,6 +202,7 @@ CREATE TABLE IF NOT EXISTS emails (forwarded INTEGER NOT NULL DEFAULT 0,html_body TEXT NOT NULL DEFAULT '',attachments TEXT NOT NULL DEFAULT '[]',+ status TEXT NOT NULL DEFAULT 'unread',created_at TEXT NOT NULL DEFAULT (datetime('now')),FOREIGN KEY (agent_id, workspace_id) REFERENCES agent(id, workspace_id) ON DELETE CASCADE);diff --git a/src/web/migrations/0003_drop_one_pending_per_conversation.sql b/src/web/migrations/0003_drop_one_pending_per_conversation.sqldeleted file mode 100644index e9a5824ac..000000000--- a/src/web/migrations/0003_drop_one_pending_per_conversation.sql+++ /dev/null@@ -1 +0,0 @@-DROP INDEX IF EXISTS idx_one_pending_per_conversation;diff --git a/src/web/migrations/0004_add_task_type.sql b/src/web/migrations/0004_add_task_type.sqldeleted file mode 100644index a58b29235..000000000--- a/src/web/migrations/0004_add_task_type.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE agent_task_queue ADD COLUMN type TEXT NOT NULL DEFAULT 'user_dm_message';diff --git a/src/web/migrations/0005_add_machine_table.sql b/src/web/migrations/0005_add_machine_table.sqldeleted file mode 100644index d753947e8..000000000--- a/src/web/migrations/0005_add_machine_table.sql+++ /dev/null@@ -1,25 +0,0 @@--- Migration: add machine table for machine-level liveness tracking--- agent_runtime loses status/last_seen_at conceptually (kept as dead columns in DB)--CREATE TABLE IF NOT EXISTS machine (- daemon_id TEXT NOT NULL,- workspace_id TEXT NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,- device_info TEXT NOT NULL DEFAULT '',- last_seen_at TEXT,- created_at TEXT NOT NULL,- updated_at TEXT NOT NULL,- PRIMARY KEY (workspace_id, daemon_id)-);---- Backfill from agent_runtime: one machine row per (daemon_id, workspace_id)-INSERT OR IGNORE INTO machine (daemon_id, workspace_id, device_info, last_seen_at, created_at, updated_at)-SELECT- daemon_id,- workspace_id,- COALESCE(MAX(device_info), ''),- MAX(last_seen_at),- MIN(created_at),- MAX(updated_at)-FROM agent_runtime-WHERE daemon_id IS NOT NULL AND daemon_id != ''-GROUP BY daemon_id, workspace_id;diff --git a/src/web/migrations/0006_email_status.sql b/src/web/migrations/0006_email_status.sqldeleted file mode 100644index bb565bd2b..000000000--- a/src/web/migrations/0006_email_status.sql+++ /dev/null@@ -1 +0,0 @@-ALTER TABLE emails ADD COLUMN status TEXT NOT NULL DEFAULT 'unread';