feat(agents): Add identity and soul template fields to board creation
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
"""add agent heartbeat config column
|
||||
|
||||
Revision ID: 2b4c2f7b3eda
|
||||
Revises: 69858cb75533
|
||||
Create Date: 2026-02-04 16:36:55.587762
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2b4c2f7b3eda'
|
||||
down_revision = '69858cb75533'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents ADD COLUMN IF NOT EXISTS heartbeat_config JSON"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute("ALTER TABLE agents DROP COLUMN IF EXISTS heartbeat_config")
|
||||
@@ -1,574 +0,0 @@
|
||||
"""init
|
||||
|
||||
Revision ID: 5630abfa60f8
|
||||
Revises:
|
||||
Create Date: 2026-02-03 17:52:47.887105
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "5630abfa60f8"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
"orgs",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("slug", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_orgs_slug"), "orgs", ["slug"], unique=True)
|
||||
op.create_table(
|
||||
"users",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("clerk_user_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("is_super_admin", sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_users_clerk_user_id"), "users", ["clerk_user_id"], unique=True)
|
||||
op.create_index(op.f("ix_users_email"), "users", ["email"], unique=False)
|
||||
op.create_table(
|
||||
"workspaces",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("slug", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_workspaces_org_id"), "workspaces", ["org_id"], unique=False)
|
||||
op.create_index(op.f("ix_workspaces_slug"), "workspaces", ["slug"], unique=False)
|
||||
op.create_table(
|
||||
"agents",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("role", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("openclaw_session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("api_token_hash", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("api_token_last_used_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_agents_openclaw_session_id"), "agents", ["openclaw_session_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_agents_org_id"), "agents", ["org_id"], unique=False)
|
||||
op.create_index(op.f("ix_agents_workspace_id"), "agents", ["workspace_id"], unique=False)
|
||||
op.create_table(
|
||||
"gateway_configs",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("base_url", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("token", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_gateway_configs_org_id"), "gateway_configs", ["org_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_gateway_configs_workspace_id"), "gateway_configs", ["workspace_id"], unique=False
|
||||
)
|
||||
op.create_table(
|
||||
"memberships",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("user_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("role", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["user_id"],
|
||||
["users.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_memberships_org_id"), "memberships", ["org_id"], unique=False)
|
||||
op.create_index(op.f("ix_memberships_user_id"), "memberships", ["user_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_memberships_workspace_id"), "memberships", ["workspace_id"], unique=False
|
||||
)
|
||||
op.create_table(
|
||||
"orchestration_templates",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("kind", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("title", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("template_markdown", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_orchestration_templates_kind"), "orchestration_templates", ["kind"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_orchestration_templates_org_id"),
|
||||
"orchestration_templates",
|
||||
["org_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_orchestration_templates_workspace_id"),
|
||||
"orchestration_templates",
|
||||
["workspace_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_table(
|
||||
"projects",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("description", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_projects_org_id"), "projects", ["org_id"], unique=False)
|
||||
op.create_index(op.f("ix_projects_status"), "projects", ["status"], unique=False)
|
||||
op.create_index(op.f("ix_projects_workspace_id"), "projects", ["workspace_id"], unique=False)
|
||||
op.create_table(
|
||||
"workspace_api_tokens",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("token_hash", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("label", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("last_used_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_workspace_api_tokens_org_id"), "workspace_api_tokens", ["org_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_workspace_api_tokens_token_hash"),
|
||||
"workspace_api_tokens",
|
||||
["token_hash"],
|
||||
unique=True,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_workspace_api_tokens_workspace_id"),
|
||||
"workspace_api_tokens",
|
||||
["workspace_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_table(
|
||||
"openclaw_sessions",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("agent_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("last_seen_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["agent_id"],
|
||||
["agents.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_openclaw_sessions_org_id"), "openclaw_sessions", ["org_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_openclaw_sessions_session_id"), "openclaw_sessions", ["session_id"], unique=True
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_openclaw_sessions_status"), "openclaw_sessions", ["status"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_openclaw_sessions_workspace_id"),
|
||||
"openclaw_sessions",
|
||||
["workspace_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_table(
|
||||
"tasks",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("project_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("title", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("description", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("priority", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("due_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("assigned_agent_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("created_by_user_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["assigned_agent_id"],
|
||||
["agents.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["created_by_user_id"],
|
||||
["users.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["project_id"],
|
||||
["projects.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_tasks_assigned_agent_id"), "tasks", ["assigned_agent_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_tasks_created_by_user_id"), "tasks", ["created_by_user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_tasks_org_id"), "tasks", ["org_id"], unique=False)
|
||||
op.create_index(op.f("ix_tasks_priority"), "tasks", ["priority"], unique=False)
|
||||
op.create_index(op.f("ix_tasks_project_id"), "tasks", ["project_id"], unique=False)
|
||||
op.create_index(op.f("ix_tasks_status"), "tasks", ["status"], unique=False)
|
||||
op.create_index(op.f("ix_tasks_workspace_id"), "tasks", ["workspace_id"], unique=False)
|
||||
op.create_table(
|
||||
"task_activities",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("task_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("activity_type", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("message", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("actor_user_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("actor_agent_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["actor_agent_id"],
|
||||
["agents.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["actor_user_id"],
|
||||
["users.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["task_id"],
|
||||
["tasks.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_task_activities_org_id"), "task_activities", ["org_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_task_activities_task_id"), "task_activities", ["task_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_task_activities_workspace_id"), "task_activities", ["workspace_id"], unique=False
|
||||
)
|
||||
op.create_table(
|
||||
"task_deliverables",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("task_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("title", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("markdown_content", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("created_by_user_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("created_by_agent_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["created_by_agent_id"],
|
||||
["agents.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["created_by_user_id"],
|
||||
["users.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["task_id"],
|
||||
["tasks.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_task_deliverables_org_id"), "task_deliverables", ["org_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_task_deliverables_task_id"), "task_deliverables", ["task_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_task_deliverables_workspace_id"),
|
||||
"task_deliverables",
|
||||
["workspace_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_table(
|
||||
"task_status_history",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("task_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("from_status", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("to_status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("actor_user_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("actor_agent_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["actor_agent_id"],
|
||||
["agents.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["actor_user_id"],
|
||||
["users.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["task_id"],
|
||||
["tasks.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_task_status_history_org_id"), "task_status_history", ["org_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_task_status_history_task_id"), "task_status_history", ["task_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_task_status_history_workspace_id"),
|
||||
"task_status_history",
|
||||
["workspace_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_table(
|
||||
"task_subagents",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("task_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("agent_name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("openclaw_session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["task_id"],
|
||||
["tasks.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_task_subagents_org_id"), "task_subagents", ["org_id"], unique=False)
|
||||
op.create_index(op.f("ix_task_subagents_task_id"), "task_subagents", ["task_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_task_subagents_workspace_id"), "task_subagents", ["workspace_id"], unique=False
|
||||
)
|
||||
op.create_table(
|
||||
"transcripts",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("task_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("full_text", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["task_id"],
|
||||
["tasks.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_transcripts_org_id"), "transcripts", ["org_id"], unique=False)
|
||||
op.create_index(op.f("ix_transcripts_session_id"), "transcripts", ["session_id"], unique=False)
|
||||
op.create_index(op.f("ix_transcripts_task_id"), "transcripts", ["task_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_transcripts_workspace_id"), "transcripts", ["workspace_id"], unique=False
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f("ix_transcripts_workspace_id"), table_name="transcripts")
|
||||
op.drop_index(op.f("ix_transcripts_task_id"), table_name="transcripts")
|
||||
op.drop_index(op.f("ix_transcripts_session_id"), table_name="transcripts")
|
||||
op.drop_index(op.f("ix_transcripts_org_id"), table_name="transcripts")
|
||||
op.drop_table("transcripts")
|
||||
op.drop_index(op.f("ix_task_subagents_workspace_id"), table_name="task_subagents")
|
||||
op.drop_index(op.f("ix_task_subagents_task_id"), table_name="task_subagents")
|
||||
op.drop_index(op.f("ix_task_subagents_org_id"), table_name="task_subagents")
|
||||
op.drop_table("task_subagents")
|
||||
op.drop_index(op.f("ix_task_status_history_workspace_id"), table_name="task_status_history")
|
||||
op.drop_index(op.f("ix_task_status_history_task_id"), table_name="task_status_history")
|
||||
op.drop_index(op.f("ix_task_status_history_org_id"), table_name="task_status_history")
|
||||
op.drop_table("task_status_history")
|
||||
op.drop_index(op.f("ix_task_deliverables_workspace_id"), table_name="task_deliverables")
|
||||
op.drop_index(op.f("ix_task_deliverables_task_id"), table_name="task_deliverables")
|
||||
op.drop_index(op.f("ix_task_deliverables_org_id"), table_name="task_deliverables")
|
||||
op.drop_table("task_deliverables")
|
||||
op.drop_index(op.f("ix_task_activities_workspace_id"), table_name="task_activities")
|
||||
op.drop_index(op.f("ix_task_activities_task_id"), table_name="task_activities")
|
||||
op.drop_index(op.f("ix_task_activities_org_id"), table_name="task_activities")
|
||||
op.drop_table("task_activities")
|
||||
op.drop_index(op.f("ix_tasks_workspace_id"), table_name="tasks")
|
||||
op.drop_index(op.f("ix_tasks_status"), table_name="tasks")
|
||||
op.drop_index(op.f("ix_tasks_project_id"), table_name="tasks")
|
||||
op.drop_index(op.f("ix_tasks_priority"), table_name="tasks")
|
||||
op.drop_index(op.f("ix_tasks_org_id"), table_name="tasks")
|
||||
op.drop_index(op.f("ix_tasks_created_by_user_id"), table_name="tasks")
|
||||
op.drop_index(op.f("ix_tasks_assigned_agent_id"), table_name="tasks")
|
||||
op.drop_table("tasks")
|
||||
op.drop_index(op.f("ix_openclaw_sessions_workspace_id"), table_name="openclaw_sessions")
|
||||
op.drop_index(op.f("ix_openclaw_sessions_status"), table_name="openclaw_sessions")
|
||||
op.drop_index(op.f("ix_openclaw_sessions_session_id"), table_name="openclaw_sessions")
|
||||
op.drop_index(op.f("ix_openclaw_sessions_org_id"), table_name="openclaw_sessions")
|
||||
op.drop_table("openclaw_sessions")
|
||||
op.drop_index(op.f("ix_workspace_api_tokens_workspace_id"), table_name="workspace_api_tokens")
|
||||
op.drop_index(op.f("ix_workspace_api_tokens_token_hash"), table_name="workspace_api_tokens")
|
||||
op.drop_index(op.f("ix_workspace_api_tokens_org_id"), table_name="workspace_api_tokens")
|
||||
op.drop_table("workspace_api_tokens")
|
||||
op.drop_index(op.f("ix_projects_workspace_id"), table_name="projects")
|
||||
op.drop_index(op.f("ix_projects_status"), table_name="projects")
|
||||
op.drop_index(op.f("ix_projects_org_id"), table_name="projects")
|
||||
op.drop_table("projects")
|
||||
op.drop_index(
|
||||
op.f("ix_orchestration_templates_workspace_id"), table_name="orchestration_templates"
|
||||
)
|
||||
op.drop_index(op.f("ix_orchestration_templates_org_id"), table_name="orchestration_templates")
|
||||
op.drop_index(op.f("ix_orchestration_templates_kind"), table_name="orchestration_templates")
|
||||
op.drop_table("orchestration_templates")
|
||||
op.drop_index(op.f("ix_memberships_workspace_id"), table_name="memberships")
|
||||
op.drop_index(op.f("ix_memberships_user_id"), table_name="memberships")
|
||||
op.drop_index(op.f("ix_memberships_org_id"), table_name="memberships")
|
||||
op.drop_table("memberships")
|
||||
op.drop_index(op.f("ix_gateway_configs_workspace_id"), table_name="gateway_configs")
|
||||
op.drop_index(op.f("ix_gateway_configs_org_id"), table_name="gateway_configs")
|
||||
op.drop_table("gateway_configs")
|
||||
op.drop_index(op.f("ix_agents_workspace_id"), table_name="agents")
|
||||
op.drop_index(op.f("ix_agents_org_id"), table_name="agents")
|
||||
op.drop_index(op.f("ix_agents_openclaw_session_id"), table_name="agents")
|
||||
op.drop_table("agents")
|
||||
op.drop_index(op.f("ix_workspaces_slug"), table_name="workspaces")
|
||||
op.drop_index(op.f("ix_workspaces_org_id"), table_name="workspaces")
|
||||
op.drop_table("workspaces")
|
||||
op.drop_index(op.f("ix_users_email"), table_name="users")
|
||||
op.drop_index(op.f("ix_users_clerk_user_id"), table_name="users")
|
||||
op.drop_table("users")
|
||||
op.drop_index(op.f("ix_orgs_slug"), table_name="orgs")
|
||||
op.drop_table("orgs")
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,29 +0,0 @@
|
||||
"""add agent heartbeat config
|
||||
|
||||
Revision ID: 69858cb75533
|
||||
Revises: f1a2b3c4d5e6
|
||||
Create Date: 2026-02-04 16:32:42.028772
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '69858cb75533'
|
||||
down_revision = 'f1a2b3c4d5e6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents ADD COLUMN IF NOT EXISTS heartbeat_config JSON"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents DROP COLUMN IF EXISTS heartbeat_config"
|
||||
)
|
||||
@@ -1,41 +0,0 @@
|
||||
"""add agent provision confirmation
|
||||
|
||||
Revision ID: 6df47d330227
|
||||
Revises: e0f28e965fa5
|
||||
Create Date: 2026-02-04 17:16:44.472239
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6df47d330227'
|
||||
down_revision = 'e0f28e965fa5'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents ADD COLUMN IF NOT EXISTS provision_requested_at TIMESTAMP"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE agents ADD COLUMN IF NOT EXISTS provision_confirm_token_hash VARCHAR"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE agents ADD COLUMN IF NOT EXISTS provision_action VARCHAR"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents DROP COLUMN IF EXISTS provision_action"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE agents DROP COLUMN IF EXISTS provision_confirm_token_hash"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE agents DROP COLUMN IF EXISTS provision_requested_at"
|
||||
)
|
||||
@@ -1,64 +0,0 @@
|
||||
"""add boards and task board id
|
||||
|
||||
Revision ID: 7e3d9b8c1f4a
|
||||
Revises: 5630abfa60f8
|
||||
Create Date: 2026-02-03 20:12:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "7e3d9b8c1f4a"
|
||||
down_revision = "5630abfa60f8"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"boards",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("slug", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_boards_org_id"), "boards", ["org_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_boards_workspace_id"), "boards", ["workspace_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_boards_slug"), "boards", ["slug"], unique=False)
|
||||
|
||||
op.add_column("tasks", sa.Column("board_id", sa.Uuid(), nullable=True))
|
||||
op.create_index(op.f("ix_tasks_board_id"), "tasks", ["board_id"], unique=False)
|
||||
op.create_foreign_key(
|
||||
"fk_tasks_board_id_boards", "tasks", "boards", ["board_id"], ["id"]
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_constraint("fk_tasks_board_id_boards", "tasks", type_="foreignkey")
|
||||
op.drop_index(op.f("ix_tasks_board_id"), table_name="tasks")
|
||||
op.drop_column("tasks", "board_id")
|
||||
|
||||
op.drop_index(op.f("ix_boards_slug"), table_name="boards")
|
||||
op.drop_index(op.f("ix_boards_workspace_id"), table_name="boards")
|
||||
op.drop_index(op.f("ix_boards_org_id"), table_name="boards")
|
||||
op.drop_table("boards")
|
||||
@@ -1,36 +0,0 @@
|
||||
"""add task assigned agent
|
||||
|
||||
Revision ID: 8045fbfb157f
|
||||
Revises: 6df47d330227
|
||||
Create Date: 2026-02-04 17:28:57.465934
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8045fbfb157f'
|
||||
down_revision = '6df47d330227'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE tasks ADD COLUMN IF NOT EXISTS assigned_agent_id UUID"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE tasks ADD CONSTRAINT IF NOT EXISTS tasks_assigned_agent_id_fkey "
|
||||
"FOREIGN KEY (assigned_agent_id) REFERENCES agents(id)"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE tasks DROP CONSTRAINT IF EXISTS tasks_assigned_agent_id_fkey"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE tasks DROP COLUMN IF EXISTS assigned_agent_id"
|
||||
)
|
||||
@@ -1,63 +0,0 @@
|
||||
"""drop projects and task project_id
|
||||
|
||||
Revision ID: 8b6d1b8f4b21
|
||||
Revises: 7e3d9b8c1f4a
|
||||
Create Date: 2026-02-03 23:05:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "8b6d1b8f4b21"
|
||||
down_revision = "7e3d9b8c1f4a"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_constraint("tasks_project_id_fkey", "tasks", type_="foreignkey")
|
||||
op.drop_index(op.f("ix_tasks_project_id"), table_name="tasks")
|
||||
op.drop_column("tasks", "project_id")
|
||||
|
||||
op.drop_index(op.f("ix_projects_workspace_id"), table_name="projects")
|
||||
op.drop_index(op.f("ix_projects_status"), table_name="projects")
|
||||
op.drop_index(op.f("ix_projects_org_id"), table_name="projects")
|
||||
op.drop_table("projects")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.create_table(
|
||||
"projects",
|
||||
sa.Column("org_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("workspace_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("description", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["org_id"],
|
||||
["orgs.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["workspace_id"],
|
||||
["workspaces.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_projects_org_id"), "projects", ["org_id"], unique=False)
|
||||
op.create_index(op.f("ix_projects_status"), "projects", ["status"], unique=False)
|
||||
op.create_index(op.f("ix_projects_workspace_id"), "projects", ["workspace_id"], unique=False)
|
||||
|
||||
op.add_column("tasks", sa.Column("project_id", sa.Uuid(), nullable=True))
|
||||
op.create_index(op.f("ix_tasks_project_id"), "tasks", ["project_id"], unique=False)
|
||||
op.create_foreign_key(
|
||||
"tasks_project_id_fkey", "tasks", "projects", ["project_id"], ["id"]
|
||||
)
|
||||
147
backend/alembic/versions/939a1d2dc607_init.py
Normal file
147
backend/alembic/versions/939a1d2dc607_init.py
Normal file
@@ -0,0 +1,147 @@
|
||||
"""init
|
||||
|
||||
Revision ID: 939a1d2dc607
|
||||
Revises:
|
||||
Create Date: 2026-02-04 19:34:33.600751
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '939a1d2dc607'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('boards',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('slug', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('gateway_url', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('gateway_token', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('gateway_main_session_key', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('gateway_workspace_root', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('identity_template', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('soul_template', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_boards_slug'), 'boards', ['slug'], unique=False)
|
||||
op.create_table('users',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('clerk_user_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('preferred_name', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('pronouns', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('timezone', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('notes', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('context', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('is_super_admin', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_users_clerk_user_id'), 'users', ['clerk_user_id'], unique=True)
|
||||
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=False)
|
||||
op.create_table('agents',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('board_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('status', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('openclaw_session_id', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('agent_token_hash', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('heartbeat_config', sa.JSON(), nullable=True),
|
||||
sa.Column('provision_requested_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('provision_confirm_token_hash', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('provision_action', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('delete_requested_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('delete_confirm_token_hash', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('last_seen_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['board_id'], ['boards.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_agents_agent_token_hash'), 'agents', ['agent_token_hash'], unique=False)
|
||||
op.create_index(op.f('ix_agents_board_id'), 'agents', ['board_id'], unique=False)
|
||||
op.create_index(op.f('ix_agents_delete_confirm_token_hash'), 'agents', ['delete_confirm_token_hash'], unique=False)
|
||||
op.create_index(op.f('ix_agents_name'), 'agents', ['name'], unique=False)
|
||||
op.create_index(op.f('ix_agents_openclaw_session_id'), 'agents', ['openclaw_session_id'], unique=False)
|
||||
op.create_index(op.f('ix_agents_provision_action'), 'agents', ['provision_action'], unique=False)
|
||||
op.create_index(op.f('ix_agents_provision_confirm_token_hash'), 'agents', ['provision_confirm_token_hash'], unique=False)
|
||||
op.create_index(op.f('ix_agents_status'), 'agents', ['status'], unique=False)
|
||||
op.create_table('tasks',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('board_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('title', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('status', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('priority', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('due_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('in_progress_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('created_by_user_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('assigned_agent_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['assigned_agent_id'], ['agents.id'], ),
|
||||
sa.ForeignKeyConstraint(['board_id'], ['boards.id'], ),
|
||||
sa.ForeignKeyConstraint(['created_by_user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_tasks_assigned_agent_id'), 'tasks', ['assigned_agent_id'], unique=False)
|
||||
op.create_index(op.f('ix_tasks_board_id'), 'tasks', ['board_id'], unique=False)
|
||||
op.create_index(op.f('ix_tasks_created_by_user_id'), 'tasks', ['created_by_user_id'], unique=False)
|
||||
op.create_index(op.f('ix_tasks_priority'), 'tasks', ['priority'], unique=False)
|
||||
op.create_index(op.f('ix_tasks_status'), 'tasks', ['status'], unique=False)
|
||||
op.create_table('activity_events',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('event_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('message', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('agent_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('task_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['agent_id'], ['agents.id'], ),
|
||||
sa.ForeignKeyConstraint(['task_id'], ['tasks.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_activity_events_agent_id'), 'activity_events', ['agent_id'], unique=False)
|
||||
op.create_index(op.f('ix_activity_events_event_type'), 'activity_events', ['event_type'], unique=False)
|
||||
op.create_index(op.f('ix_activity_events_task_id'), 'activity_events', ['task_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_activity_events_task_id'), table_name='activity_events')
|
||||
op.drop_index(op.f('ix_activity_events_event_type'), table_name='activity_events')
|
||||
op.drop_index(op.f('ix_activity_events_agent_id'), table_name='activity_events')
|
||||
op.drop_table('activity_events')
|
||||
op.drop_index(op.f('ix_tasks_status'), table_name='tasks')
|
||||
op.drop_index(op.f('ix_tasks_priority'), table_name='tasks')
|
||||
op.drop_index(op.f('ix_tasks_created_by_user_id'), table_name='tasks')
|
||||
op.drop_index(op.f('ix_tasks_board_id'), table_name='tasks')
|
||||
op.drop_index(op.f('ix_tasks_assigned_agent_id'), table_name='tasks')
|
||||
op.drop_table('tasks')
|
||||
op.drop_index(op.f('ix_agents_status'), table_name='agents')
|
||||
op.drop_index(op.f('ix_agents_provision_confirm_token_hash'), table_name='agents')
|
||||
op.drop_index(op.f('ix_agents_provision_action'), table_name='agents')
|
||||
op.drop_index(op.f('ix_agents_openclaw_session_id'), table_name='agents')
|
||||
op.drop_index(op.f('ix_agents_name'), table_name='agents')
|
||||
op.drop_index(op.f('ix_agents_delete_confirm_token_hash'), table_name='agents')
|
||||
op.drop_index(op.f('ix_agents_board_id'), table_name='agents')
|
||||
op.drop_index(op.f('ix_agents_agent_token_hash'), table_name='agents')
|
||||
op.drop_table('agents')
|
||||
op.drop_index(op.f('ix_users_email'), table_name='users')
|
||||
op.drop_index(op.f('ix_users_clerk_user_id'), table_name='users')
|
||||
op.drop_table('users')
|
||||
op.drop_index(op.f('ix_boards_slug'), table_name='boards')
|
||||
op.drop_table('boards')
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,56 +0,0 @@
|
||||
"""drop tenancy tables and columns
|
||||
|
||||
Revision ID: 9c4f1a2b3d4e
|
||||
Revises: 8b6d1b8f4b21
|
||||
Create Date: 2026-02-03 23:35:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "9c4f1a2b3d4e"
|
||||
down_revision = "8b6d1b8f4b21"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_table("task_subagents")
|
||||
op.drop_table("task_status_history")
|
||||
op.drop_table("task_deliverables")
|
||||
op.drop_table("task_activities")
|
||||
op.drop_table("transcripts")
|
||||
op.drop_table("openclaw_sessions")
|
||||
op.drop_table("workspace_api_tokens")
|
||||
op.drop_table("orchestration_templates")
|
||||
op.drop_table("memberships")
|
||||
op.drop_table("gateway_configs")
|
||||
|
||||
op.drop_constraint("tasks_assigned_agent_id_fkey", "tasks", type_="foreignkey")
|
||||
op.drop_constraint("tasks_org_id_fkey", "tasks", type_="foreignkey")
|
||||
op.drop_constraint("tasks_workspace_id_fkey", "tasks", type_="foreignkey")
|
||||
op.drop_index(op.f("ix_tasks_assigned_agent_id"), table_name="tasks")
|
||||
op.drop_index(op.f("ix_tasks_org_id"), table_name="tasks")
|
||||
op.drop_index(op.f("ix_tasks_workspace_id"), table_name="tasks")
|
||||
op.drop_column("tasks", "assigned_agent_id")
|
||||
op.drop_column("tasks", "org_id")
|
||||
op.drop_column("tasks", "workspace_id")
|
||||
|
||||
op.drop_constraint("boards_org_id_fkey", "boards", type_="foreignkey")
|
||||
op.drop_constraint("boards_workspace_id_fkey", "boards", type_="foreignkey")
|
||||
op.drop_index(op.f("ix_boards_org_id"), table_name="boards")
|
||||
op.drop_index(op.f("ix_boards_workspace_id"), table_name="boards")
|
||||
op.drop_column("boards", "org_id")
|
||||
op.drop_column("boards", "workspace_id")
|
||||
|
||||
op.drop_table("agents")
|
||||
op.drop_table("workspaces")
|
||||
op.drop_table("orgs")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise NotImplementedError("Downgrade not supported for simplified tenancy removal.")
|
||||
@@ -1,70 +0,0 @@
|
||||
"""add agents and activity events
|
||||
|
||||
Revision ID: a1b2c3d4e5f6
|
||||
Revises: 9c4f1a2b3d4e
|
||||
Create Date: 2026-02-03 23:50:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "a1b2c3d4e5f6"
|
||||
down_revision = "9c4f1a2b3d4e"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"agents",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("last_seen_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_agents_name"), "agents", ["name"], unique=False)
|
||||
op.create_index(op.f("ix_agents_status"), "agents", ["status"], unique=False)
|
||||
|
||||
op.create_table(
|
||||
"activity_events",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("event_type", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("message", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("agent_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("task_id", sa.Uuid(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["agent_id"], ["agents.id"]),
|
||||
sa.ForeignKeyConstraint(["task_id"], ["tasks.id"]),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_activity_events_agent_id"), "activity_events", ["agent_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_activity_events_event_type"),
|
||||
"activity_events",
|
||||
["event_type"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_activity_events_task_id"), "activity_events", ["task_id"], unique=False
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_activity_events_task_id"), table_name="activity_events")
|
||||
op.drop_index(op.f("ix_activity_events_event_type"), table_name="activity_events")
|
||||
op.drop_index(op.f("ix_activity_events_agent_id"), table_name="activity_events")
|
||||
op.drop_table("activity_events")
|
||||
op.drop_index(op.f("ix_agents_status"), table_name="agents")
|
||||
op.drop_index(op.f("ix_agents_name"), table_name="agents")
|
||||
op.drop_table("agents")
|
||||
@@ -1,29 +0,0 @@
|
||||
"""add task comments index
|
||||
|
||||
Revision ID: b9d22e2a4d50
|
||||
Revises: 8045fbfb157f
|
||||
Create Date: 2026-02-04 17:32:06.204331
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b9d22e2a4d50'
|
||||
down_revision = '8045fbfb157f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"CREATE INDEX IF NOT EXISTS ix_activity_events_task_comment "
|
||||
"ON activity_events (task_id, created_at) "
|
||||
"WHERE event_type = 'task.comment'"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute("DROP INDEX IF EXISTS ix_activity_events_task_comment")
|
||||
@@ -1,31 +0,0 @@
|
||||
"""add task in_progress_at
|
||||
|
||||
Revision ID: c1a2b3c4d5e7
|
||||
Revises: b9d22e2a4d50
|
||||
Create Date: 2026-02-04 13:34:25.000000
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "c1a2b3c4d5e7"
|
||||
down_revision = "b9d22e2a4d50"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE tasks ADD COLUMN IF NOT EXISTS in_progress_at TIMESTAMP WITHOUT TIME ZONE"
|
||||
)
|
||||
op.execute(
|
||||
"CREATE INDEX IF NOT EXISTS ix_tasks_in_progress_at ON tasks (in_progress_at)"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute("DROP INDEX IF EXISTS ix_tasks_in_progress_at")
|
||||
op.execute("ALTER TABLE tasks DROP COLUMN IF EXISTS in_progress_at")
|
||||
@@ -1,38 +0,0 @@
|
||||
"""add agent openclaw session id
|
||||
|
||||
Revision ID: c7f0a2b1d4e3
|
||||
Revises: a1b2c3d4e5f6
|
||||
Create Date: 2026-02-04 02:20:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "c7f0a2b1d4e3"
|
||||
down_revision = "a1b2c3d4e5f6"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"agents",
|
||||
sa.Column("openclaw_session_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_agents_openclaw_session_id"),
|
||||
"agents",
|
||||
["openclaw_session_id"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_agents_openclaw_session_id"), table_name="agents")
|
||||
op.drop_column("agents", "openclaw_session_id")
|
||||
@@ -1,29 +0,0 @@
|
||||
"""ensure heartbeat config column
|
||||
|
||||
Revision ID: cefef25d4634
|
||||
Revises: 2b4c2f7b3eda
|
||||
Create Date: 2026-02-04 16:38:25.234627
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'cefef25d4634'
|
||||
down_revision = '2b4c2f7b3eda'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents ADD COLUMN IF NOT EXISTS heartbeat_config JSON"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents DROP COLUMN IF EXISTS heartbeat_config"
|
||||
)
|
||||
@@ -1,38 +0,0 @@
|
||||
"""add agent token hash
|
||||
|
||||
Revision ID: d3e4f5a6b7c8
|
||||
Revises: c7f0a2b1d4e3
|
||||
Create Date: 2026-02-04 06:50:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "d3e4f5a6b7c8"
|
||||
down_revision = "c7f0a2b1d4e3"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"agents",
|
||||
sa.Column("agent_token_hash", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_agents_agent_token_hash"),
|
||||
"agents",
|
||||
["agent_token_hash"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_agents_agent_token_hash"), table_name="agents")
|
||||
op.drop_column("agents", "agent_token_hash")
|
||||
@@ -1,35 +0,0 @@
|
||||
"""add agent delete confirmation
|
||||
|
||||
Revision ID: e0f28e965fa5
|
||||
Revises: cefef25d4634
|
||||
Create Date: 2026-02-04 16:55:33.389505
|
||||
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e0f28e965fa5'
|
||||
down_revision = 'cefef25d4634'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents ADD COLUMN IF NOT EXISTS delete_requested_at TIMESTAMP"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE agents ADD COLUMN IF NOT EXISTS delete_confirm_token_hash VARCHAR"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE agents DROP COLUMN IF EXISTS delete_confirm_token_hash"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE agents DROP COLUMN IF EXISTS delete_requested_at"
|
||||
)
|
||||
@@ -1,27 +0,0 @@
|
||||
"""make agent last_seen_at nullable
|
||||
|
||||
Revision ID: e4f5a6b7c8d9
|
||||
Revises: d3e4f5a6b7c8
|
||||
Create Date: 2026-02-04 07:10:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "e4f5a6b7c8d9"
|
||||
down_revision = "d3e4f5a6b7c8"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.alter_column("agents", "last_seen_at", existing_type=sa.DateTime(), nullable=True)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.alter_column("agents", "last_seen_at", existing_type=sa.DateTime(), nullable=False)
|
||||
@@ -1,47 +0,0 @@
|
||||
"""add board gateway config
|
||||
|
||||
Revision ID: f1a2b3c4d5e6
|
||||
Revises: e4f5a6b7c8d9
|
||||
Create Date: 2026-02-04 00:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "f1a2b3c4d5e6"
|
||||
down_revision = "e4f5a6b7c8d9"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("boards", sa.Column("gateway_url", sa.String(), nullable=True))
|
||||
op.add_column("boards", sa.Column("gateway_token", sa.String(), nullable=True))
|
||||
op.add_column(
|
||||
"boards", sa.Column("gateway_main_session_key", sa.String(), nullable=True)
|
||||
)
|
||||
op.add_column(
|
||||
"boards", sa.Column("gateway_workspace_root", sa.String(), nullable=True)
|
||||
)
|
||||
|
||||
op.add_column("agents", sa.Column("board_id", sa.Uuid(), nullable=True))
|
||||
op.create_foreign_key(
|
||||
"agents_board_id_fkey", "agents", "boards", ["board_id"], ["id"]
|
||||
)
|
||||
op.create_index(op.f("ix_agents_board_id"), "agents", ["board_id"], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_agents_board_id"), table_name="agents")
|
||||
op.drop_constraint("agents_board_id_fkey", "agents", type_="foreignkey")
|
||||
op.drop_column("agents", "board_id")
|
||||
|
||||
op.drop_column("boards", "gateway_workspace_root")
|
||||
op.drop_column("boards", "gateway_main_session_key")
|
||||
op.drop_column("boards", "gateway_token")
|
||||
op.drop_column("boards", "gateway_url")
|
||||
Reference in New Issue
Block a user