You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.7 KiB
Python
96 lines
3.7 KiB
Python
"""phase14 proactive agent + multimodal: errand_task/errand_step/proactive_card/weekly_review
|
|
|
|
Revision ID: p14b2c3d4e5f6
|
|
Revises: p13a1b2c3d4e5
|
|
Create Date: 2026-06-15 07:00:00.000000
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
import sqlmodel
|
|
from alembic import op
|
|
|
|
revision: str = "p14b2c3d4e5f6"
|
|
down_revision: Union[str, Sequence[str], None] = "p13a1b2c3d4e5"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
S = sqlmodel.sql.sqltypes.AutoString
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"errand_task",
|
|
sa.Column("id", S(), nullable=False),
|
|
sa.Column("kind", S(), nullable=False),
|
|
sa.Column("title", S(), nullable=False),
|
|
sa.Column("goal", S(), nullable=False),
|
|
sa.Column("target", S(), nullable=True),
|
|
sa.Column("tone", S(), nullable=False),
|
|
sa.Column("status", S(), nullable=False),
|
|
sa.Column("autonomy_at_start", S(), nullable=False),
|
|
sa.Column("approval_id", S(), nullable=True),
|
|
sa.Column("result_summary", S(), nullable=True),
|
|
sa.Column("model", S(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
|
sa.ForeignKeyConstraint(["approval_id"], ["approval.id"]),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"errand_step",
|
|
sa.Column("id", S(), nullable=False),
|
|
sa.Column("errand_id", S(), nullable=False),
|
|
sa.Column("seq", sa.Integer(), nullable=False),
|
|
sa.Column("phase", S(), nullable=False),
|
|
sa.Column("tool", S(), nullable=True),
|
|
sa.Column("label", S(), nullable=False),
|
|
sa.Column("detail", S(), nullable=True),
|
|
sa.Column("external_effect", sa.Boolean(), nullable=False),
|
|
sa.Column("state", S(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
sa.ForeignKeyConstraint(["errand_id"], ["errand_task.id"]),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index("ix_errand_step_errand_id", "errand_step", ["errand_id"])
|
|
op.create_table(
|
|
"proactive_card",
|
|
sa.Column("id", S(), nullable=False),
|
|
sa.Column("kind", S(), nullable=False),
|
|
sa.Column("icon", S(), nullable=False),
|
|
sa.Column("tone", S(), nullable=False),
|
|
sa.Column("title", S(), nullable=False),
|
|
sa.Column("why", S(), nullable=False),
|
|
sa.Column("cta", S(), nullable=True),
|
|
sa.Column("action_kind", S(), nullable=True),
|
|
sa.Column("action_payload", S(), nullable=True),
|
|
sa.Column("detected_at", S(), nullable=False),
|
|
sa.Column("status", S(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"weekly_review",
|
|
sa.Column("id", S(), nullable=False),
|
|
sa.Column("week_label", S(), nullable=False),
|
|
sa.Column("deep_work_h", sa.Float(), nullable=False),
|
|
sa.Column("meeting_h", sa.Float(), nullable=False),
|
|
sa.Column("done_count", sa.Integer(), nullable=False),
|
|
sa.Column("auto_count", sa.Integer(), nullable=False),
|
|
sa.Column("saved_minutes", sa.Integer(), nullable=False),
|
|
sa.Column("patterns_json", S(), nullable=False),
|
|
sa.Column("note", S(), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_table("weekly_review")
|
|
op.drop_table("proactive_card")
|
|
op.drop_index("ix_errand_step_errand_id", table_name="errand_step")
|
|
op.drop_table("errand_step")
|
|
op.drop_table("errand_task")
|