Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
62 lines
1.8 KiB
Go
62 lines
1.8 KiB
Go
package workspace
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func (s *SQLiteStore) applyCollabRunsV1(ctx context.Context) error {
|
|
applied, err := s.hasMigration(ctx, schemaMigrationCollabRunsV1)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if applied {
|
|
return nil
|
|
}
|
|
|
|
now := unixMs(time.Now().UTC())
|
|
_, err = s.writeDB.ExecContext(ctx, `
|
|
CREATE TABLE IF NOT EXISTS collaboration_runs (
|
|
workspace_id TEXT NOT NULL,
|
|
run_id TEXT NOT NULL,
|
|
mode TEXT NOT NULL,
|
|
trigger_source TEXT NOT NULL,
|
|
trigger_reason TEXT NOT NULL DEFAULT '',
|
|
source_session_id TEXT NOT NULL DEFAULT '',
|
|
target_session_id TEXT NOT NULL DEFAULT '',
|
|
target_agent_target_id TEXT NOT NULL DEFAULT '',
|
|
model_plan_id TEXT NOT NULL DEFAULT '',
|
|
model TEXT NOT NULL DEFAULT '',
|
|
context_scope TEXT NOT NULL DEFAULT '',
|
|
prompt TEXT NOT NULL DEFAULT '',
|
|
result_text TEXT NOT NULL DEFAULT '',
|
|
failure_reason TEXT NOT NULL DEFAULT '',
|
|
status TEXT NOT NULL,
|
|
adoption TEXT NOT NULL DEFAULT 'pending',
|
|
input_tokens INTEGER NOT NULL DEFAULT 0,
|
|
output_tokens INTEGER NOT NULL DEFAULT 0,
|
|
started_at_unix_ms INTEGER NOT NULL DEFAULT 0,
|
|
completed_at_unix_ms INTEGER NOT NULL DEFAULT 0,
|
|
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
created_at_unix_ms INTEGER NOT NULL,
|
|
updated_at_unix_ms INTEGER NOT NULL,
|
|
PRIMARY KEY (workspace_id, run_id),
|
|
FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_collaboration_runs_workspace_source
|
|
ON collaboration_runs(workspace_id, source_session_id);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_collaboration_runs_workspace_created
|
|
ON collaboration_runs(workspace_id, created_at_unix_ms DESC);
|
|
|
|
INSERT INTO tuttid_schema_migrations (id, applied_at_unix_ms)
|
|
VALUES (?, ?);
|
|
`, schemaMigrationCollabRunsV1, now)
|
|
if err != nil {
|
|
return fmt.Errorf("migrate collaboration runs v1: %w", err)
|
|
}
|
|
return nil
|
|
}
|